require("../../@babel/runtime/helpers/Arrayincludes");
var t = require("../../@babel/runtime/helpers/regeneratorRuntime"),
  e = require("../../@babel/runtime/helpers/asyncToGenerator"),
  n = require("../../@babel/runtime/helpers/typeof");
!(function (t, e) {
  if (
    "object" == ("undefined" == typeof exports ? "undefined" : n(exports)) &&
    "object" == ("undefined" == typeof module ? "undefined" : n(module))
  )
    module.exports = e();
  else if ("function" == typeof define && define.amd) define([], e);
  else {
    var i = e();
    for (var s in i)
      ("object" == ("undefined" == typeof exports ? "undefined" : n(exports))
        ? exports
        : void 0)[s] = i[s];
  }
})(0, function () {
  return (function (t) {
    var e = {};
    function i(n) {
      if (e[n]) return e[n].exports;
      var s = (e[n] = { i: n, l: !1, exports: {} });
      return t[n].call(s.exports, s, s.exports, i), (s.l = !0), s.exports;
    }
    return (
      (i.m = t),
      (i.c = e),
      (i.d = function (t, e, n) {
        i.o(t, e) || Object.defineProperty(t, e, { enumerable: !0, get: n });
      }),
      (i.r = function (t) {
        "undefined" != typeof Symbol &&
          Symbol.toStringTag &&
          Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }),
          Object.defineProperty(t, "__esModule", { value: !0 });
      }),
      (i.t = function (t, e) {
        if ((1 & e && (t = i(t)), 8 & e)) return t;
        if (4 & e && "object" == n(t) && t && t.__esModule) return t;
        var s = Object.create(null);
        if (
          (i.r(s),
          Object.defineProperty(s, "default", { enumerable: !0, value: t }),
          2 & e && "string" != typeof t)
        )
          for (var r in t)
            i.d(
              s,
              r,
              function (e) {
                return t[e];
              }.bind(null, r),
            );
        return s;
      }),
      (i.n = function (t) {
        var e =
          t && t.__esModule
            ? function () {
                return t.default;
              }
            : function () {
                return t;
              };
        return i.d(e, "a", e), e;
      }),
      (i.o = function (t, e) {
        return Object.prototype.hasOwnProperty.call(t, e);
      }),
      (i.p = ""),
      i((i.s = 61))
    );
  })([
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 });
      (e.CONSTANTS = {
        DEVICE: { ANDROID: 0, IOS: 1, MONITOR: 2 },
        PHONE_PLACEMENT: { HOLD: 0, OTHER: 1 },
        ACC_SENSOR_STATUS: { EMPTY: -1, LOW_FREQ: 1, NORMAL: 2 },
        DRIVING_MODE: { INDOOR: 0, OUTDOOR: 1 },
        HEADSTATUS: { NORMAL: 0, DRIFT: 1, ERROR: 2 },
        FUSION_MODEL: { DIFF: 0, PDR: 1 },
        POSITION: { MODE: { DRIVING: 0, WALKING: 1 } },
      }),
        (e.KF_TYPE = {
          PDR_WLK: 0,
          PDR_NAV: 1,
          DIFF_WLK: 2,
          DIFF_BASE: 3,
          DIFF_DRV: 4,
          DIFF_DRV_OUT_AND: 5,
          DIFF_DRV_OUT_IOS: 6,
          MONITOR_WLK: 7,
        }),
        (e.LOC_AREA_STATUS = {
          BUILDING: 1,
          OUT_BUILDING: 2,
          EXCEED: 3,
          UNSET: 4,
        }),
        (e.POSITION_MODE = { DRIVING: 0, WALKING: 1 }),
        (e.MOTION_STATE = {
          UNCERTAIN: 0,
          STATIC: 1,
          WALKING: 2,
          RUN: 3,
          DRIVING: 4,
        }),
        (e.TRANS_FLOOR_TYPE = { NULL: 0, STAIRS: 1, ELEVATOR: 2, LIFT: 3 }),
        (e.ACCORD_LEVEL = { DEVIATED: -1, UNCERTAIN: 0, GOOD: 1, FINE: 2 });
    },
    function (t, e, i) {
      var s = i(21),
        r = i(37),
        o = Object.prototype.toString;
      function a(t) {
        return "[object Array]" === o.call(t);
      }
      function h(t) {
        return null !== t && "object" == n(t);
      }
      function l(t) {
        return "[object Function]" === o.call(t);
      }
      function c(t, e) {
        if (null != t)
          if (("object" != n(t) && (t = [t]), a(t)))
            for (var i = 0, s = t.length; i < s; i++) e.call(null, t[i], i, t);
          else
            for (var r in t)
              Object.prototype.hasOwnProperty.call(t, r) &&
                e.call(null, t[r], r, t);
      }
      t.exports = {
        isArray: a,
        isArrayBuffer: function (t) {
          return "[object ArrayBuffer]" === o.call(t);
        },
        isBuffer: r,
        isFormData: function (t) {
          return "undefined" != typeof FormData && t instanceof FormData;
        },
        isArrayBufferView: function (t) {
          return "undefined" != typeof ArrayBuffer && ArrayBuffer.isView
            ? ArrayBuffer.isView(t)
            : t && t.buffer && t.buffer instanceof ArrayBuffer;
        },
        isString: function (t) {
          return "string" == typeof t;
        },
        isNumber: function (t) {
          return "number" == typeof t;
        },
        isObject: h,
        isUndefined: function (t) {
          return void 0 === t;
        },
        isDate: function (t) {
          return "[object Date]" === o.call(t);
        },
        isFile: function (t) {
          return "[object File]" === o.call(t);
        },
        isBlob: function (t) {
          return "[object Blob]" === o.call(t);
        },
        isFunction: l,
        isStream: function (t) {
          return h(t) && l(t.pipe);
        },
        isURLSearchParams: function (t) {
          return (
            "undefined" != typeof URLSearchParams &&
            t instanceof URLSearchParams
          );
        },
        isStandardBrowserEnv: function () {
          return (
            ("undefined" == typeof navigator ||
              "ReactNative" !== navigator.product) &&
            "undefined" != typeof window &&
            "undefined" != typeof document
          );
        },
        forEach: c,
        merge: function t() {
          var e = {};
          function i(i, s) {
            "object" == n(e[s]) && "object" == n(i)
              ? (e[s] = t(e[s], i))
              : (e[s] = i);
          }
          for (var s = 0, r = arguments.length; s < r; s++) c(arguments[s], i);
          return e;
        },
        extend: function (t, e, i) {
          return (
            c(e, function (e, n) {
              t[n] = i && "function" == typeof e ? s(e, i) : e;
            }),
            t
          );
        },
        trim: function (t) {
          return t.replace(/^\s*/, "").replace(/\s*$/, "");
        },
      };
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.LocationUtils = void 0);
      var n = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        s = i(3),
        r = (function () {
          function t() {
            !(function (t, e) {
              if (!(t instanceof e))
                throw new TypeError("Cannot call a class as a function");
            })(this, t);
          }
          return (
            n(t, null, [
              {
                key: "checkInRegion",
                value: function (t, e, i, n) {
                  var r = !1;
                  if (e && t)
                    for (var o = 0; o < t.length; ++o)
                      if (
                        (void 0 === i ||
                          i === t[o].z ||
                          (void 0 === t[o].z && !t[o].zs) ||
                          (t[o].zs && t[o].zs.includes(i)) ||
                          (0 === n && "top_open" === t[o].type)) &&
                        (0 === t[o].polygon ||
                          s.Geometric.isPointInPolygon(e, t[o].polygon))
                      ) {
                        r = !0;
                        break;
                      }
                  return r;
                },
              },
              {
                key: "checkInWhichRegion",
                value: function (t, e, i) {
                  var n = -1;
                  if (e && t)
                    for (var r = 0; r < t.length; ++r)
                      if (
                        (void 0 === i ||
                          i === t[r].z ||
                          (void 0 === t[r].z && !t[r].zs) ||
                          (t[r].zs && t[r].zs.includes(i))) &&
                        (0 === t[r].polygon ||
                          s.Geometric.isPointInPolygon(e, t[r].polygon))
                      ) {
                        n = r;
                        break;
                      }
                  return n;
                },
              },
              {
                key: "loadRegionPolygons",
                value: function (t) {
                  if (t && t.length > 0 && "polygon" in t[0]) return t;
                  var e = [];
                  return (
                    t.forEach(function (t) {
                      var i = {
                        polygon: t.map(function (t) {
                          return [t[0], t[1]];
                        }),
                        z: t[0][2],
                      };
                      e.push(i);
                    }),
                    e
                  );
                },
              },
              {
                key: "angleDiff",
                value: function (t, e) {
                  var i = t - e;
                  return i >= 180 && (i -= 360), i <= -180 && (i += 360), i;
                },
              },
              {
                key: "standardDeviation",
                value: function (t) {
                  var e = function (t, e) {
                      return t + e;
                    },
                    i = t.reduce(e, 0) / t.length,
                    n = t.map(function (t) {
                      return t - i;
                    });
                  return Math.sqrt(
                    n
                      .map(function (t) {
                        return t * t;
                      })
                      .reduce(e, 0) /
                      (t.length - 1),
                  );
                },
              },
              {
                key: "distance",
                value: function (t, e) {
                  return t && e
                    ? Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2))
                    : -1;
                },
              },
              {
                key: "debugMessage",
                value: function (t) {
                  try {
                    var e = document.getElementById("debug_message_container");
                    if (
                      (e ||
                        ((e = document.createElement("div")),
                        document.body.appendChild(e),
                        e.setAttribute("id", "debug_message_container"),
                        e.setAttribute(
                          "style",
                          "position:absolute;top:20%;color:red;z-index:99;background-color: rgba(255,255,255,0.25);font-size:10px",
                        ),
                        (e.onclick = function () {
                          e.innerHTML = "";
                        })),
                      t)
                    ) {
                      var i = e.innerHTML.split("<br>"),
                        n = "";
                      t.includes("---")
                        ? (n = t)
                        : i.length > 0 && i[0].includes("---") && (n = i[0]);
                      var s = "";
                      t.includes("+++")
                        ? (s = t)
                        : i.length > 1 && i[1].includes("+++") && (s = i[1]);
                      var r = "";
                      t.includes("***")
                        ? (r = t)
                        : i.length > 2 && i[2].includes("***") && (r = i[2]);
                      var o = n + "<br>" + s + "<br>" + r;
                      e.innerHTML = o + "<br>";
                    } else e.innerHTML = "";
                  } catch (t) {}
                },
              },
              {
                key: "copyInstance",
                value: function (t) {
                  return Object.assign(
                    Object.create(Object.getPrototypeOf(t)),
                    t,
                  );
                },
              },
            ]),
            t
          );
        })();
      e.LocationUtils = r;
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.Geometric = void 0);
      var n = function (t, e) {
          if (Array.isArray(t)) return t;
          if (Symbol.iterator in Object(t))
            return (function (t, e) {
              var i = [],
                n = !0,
                s = !1,
                r = void 0;
              try {
                for (
                  var o, a = t[Symbol.iterator]();
                  !(n = (o = a.next()).done) &&
                  (i.push(o.value), !e || i.length !== e);
                  n = !0
                );
              } catch (t) {
                (s = !0), (r = t);
              } finally {
                try {
                  !n && a.return && a.return();
                } finally {
                  if (s) throw r;
                }
              }
              return i;
            })(t, e);
          throw new TypeError(
            "Invalid attempt to destructure non-iterable instance",
          );
        },
        s = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        r = i(4),
        o = i(6),
        a = (function () {
          function t() {
            !(function (t, e) {
              if (!(t instanceof e))
                throw new TypeError("Cannot call a class as a function");
            })(this, t);
          }
          return (
            s(t, null, [
              {
                key: "angleDiffRad",
                value: function (t, e) {
                  var i = t - e;
                  return (
                    i >= Math.PI && (i -= 2 * Math.PI),
                    i <= -Math.PI && (i += 2 * Math.PI),
                    i
                  );
                },
              },
              {
                key: "angleDiffDeg",
                value: function (t, e) {
                  var i = t - e;
                  return i >= 180 && (i -= 360), i <= -180 && (i += 360), i;
                },
              },
              {
                key: "angleBetweenVectors",
                value: function (t, e) {
                  var i = t[0],
                    n = t[1],
                    s = e[0],
                    o = e[1],
                    a = Math.sqrt(i * i + n * n) * Math.sqrt(s * s + o * o);
                  if (0 === a) return 0;
                  var h = i * o - n * s > 0 ? -1 : 1,
                    l = i * s + n * o;
                  (l > a || -l > a) && (l = a);
                  var c = l / a;
                  return r.Numerical.toFixed(h * Math.acos(c), 2);
                },
              },
              {
                key: "angleBetweenVectors3D",
                value: function (t, e) {
                  var i = t[0],
                    n = t[1],
                    s = t[2],
                    o = e[0],
                    a = e[1],
                    h = e[2],
                    l =
                      Math.sqrt(i * i + n * n + s * s) *
                      Math.sqrt(o * o + a * a + h * h);
                  if (0 === l) return 0;
                  var c = i * o + n * a + s * h;
                  return (
                    (c > l || -c > l) && (c = l),
                    r.Numerical.toFixed(Math.acos(c / l), 2)
                  );
                },
              },
              {
                key: "euclideanDistance",
                value: function (e, i) {
                  var n = t.formatPoint(e),
                    s = t.formatPoint(i);
                  if (!n || !s) return -1;
                  var o = Math.sqrt(
                    Math.pow(n.x - s.x, 2) +
                      Math.pow(n.y - s.y, 2) +
                      Math.pow(n.z - s.z, 2),
                  );
                  return r.Numerical.toFixed(o, 2);
                },
              },
              {
                key: "projectPoint2Segment",
                value: function (e, i, n) {
                  "z" in e || console.warn("point should have z property");
                  var s = t.formatPoint(e),
                    r = t.formatPoint(i),
                    o = t.formatPoint(n),
                    a =
                      (s.x - r.x) * (o.x - r.x) +
                      (s.y - r.y) * (o.y - r.y) +
                      (s.z - r.z) * (o.z - r.z);
                  if (a <= 0) return [t.euclideanDistance(s, r), r, 0];
                  var h = Math.pow(t.euclideanDistance(r, o), 2);
                  if (a >= h) return [t.euclideanDistance(s, o), o, 2];
                  var l = a / h,
                    c = {
                      x: r.x + l * (o.x - r.x),
                      y: r.y + l * (o.y - r.y),
                      z: r.z + l * (o.z - r.z),
                    };
                  return [t.euclideanDistance(s, c), c, 1];
                },
              },
              {
                key: "vectorDirDeg",
                value: function (t, e) {
                  return (180 * Math.atan2(e.x - t.x, e.y - t.y)) / Math.PI;
                },
              },
              {
                key: "vectorDirRad",
                value: function (t, e) {
                  return Math.atan2(e.x - t.x, e.y - t.y);
                },
              },
              {
                key: "rotateAngle",
                value: function (t, e) {
                  if (void 0 === e || null == e) return null;
                  var i = Math.sin(t),
                    n = Math.cos(t),
                    s = i * Math.cos(e) + n * Math.sin(e),
                    o = n * Math.cos(e) - i * Math.sin(e);
                  return r.Numerical.toFixed(Math.atan2(s, o), 2);
                },
              },
              {
                key: "isPointInPolygon",
                value: function (e, i, n) {
                  var s = t.formatPolygon(i, n),
                    r = t.formatPoint(e);
                  if (!r || !s) return !1;
                  for (
                    var o = !1, a = 0, h = s.length - 1;
                    a < s.length;
                    h = a++
                  ) {
                    var l = s[a].x,
                      c = s[a].y,
                      u = s[h].x,
                      f = s[h].y;
                    if (t.projectPoint2Segment(r, s[a], s[h])[0] < 1e-8)
                      return !0;
                    c > r.y != f > r.y &&
                      r.x < ((u - l) * (r.y - c)) / (f - c) + l &&
                      (o = !o);
                  }
                  return o;
                },
              },
              {
                key: "isPointInRoad",
                value: function (e, i, n) {
                  var s = void 0;
                  switch (i.type) {
                    case o.RoadType.POLYGON:
                      s = i.vertexes;
                      break;
                    case o.RoadType.MULTIPOLYGON:
                      s = i.vertexes[0];
                      break;
                    default:
                      return !1;
                  }
                  return t.isPointInPolygon(e, s, n);
                },
              },
              {
                key: "getCompletePolygon",
                value: function (t, e) {
                  var i = [];
                  return (
                    t.forEach(function (t) {
                      i.push(e[t]);
                    }),
                    i
                  );
                },
              },
              {
                key: "dim2List2ObjList",
                value: function (t, e) {
                  void 0 === e && (e = 0);
                  var i = [];
                  return (
                    t.forEach(function (t) {
                      i.push({ x: t[0], y: t[1], z: e });
                    }),
                    i
                  );
                },
              },
              {
                key: "formatPolygon",
                value: function (e, i) {
                  var n = e;
                  if (!Array.isArray(e))
                    return console.error("illegal polygon data"), null;
                  if (Array.isArray(e[0])) n = t.dim2List2ObjList(e);
                  else if (e[0].hasOwnProperty("x"));
                  else {
                    if (!i) return console.error("illegal polygon data"), null;
                    n = t.getCompletePolygon(e, i);
                  }
                  return (
                    n[0].x === n[n.length - 1].x &&
                      n[0].y === n[n.length - 1].y &&
                      n.shift(),
                    n
                  );
                },
              },
              {
                key: "formatPoint",
                value: function (t) {
                  var e = {};
                  if (Array.isArray(t))
                    2 === t.length && (e = { x: t[0], y: t[1], z: 0 }),
                      3 === t.length && (e = { x: t[0], y: t[1], z: t[2] });
                  else {
                    if (!t.hasOwnProperty("x") || !t.hasOwnProperty("y"))
                      return console.error("illegal point data"), null;
                    (e = t), t.hasOwnProperty("z") || (e.z = 0);
                  }
                  return e;
                },
              },
              {
                key: "projectPoint2Road",
                value: function (e, i, n) {
                  if (i.type === o.RoadType.LINE)
                    return t.projectPoint2Segment(
                      e,
                      n[i.vertexes[0]],
                      n[i.vertexes[1]],
                    );
                  if (t.isPointInRoad(e, i, n)) {
                    if (i.type === o.RoadType.MULTIPOLYGON)
                      for (var s = 1; s < i.vertexes.length; s++)
                        if (t.isPointInPolygon(e, i.vertexes[s], n))
                          return t.projectPoint2PolygonEdge(
                            e,
                            i.vertexes[s],
                            n,
                          );
                    return [0, e];
                  }
                  var r = void 0;
                  return (
                    i.type === o.RoadType.POLYGON
                      ? (r = i.vertexes)
                      : i.type === o.RoadType.MULTIPOLYGON &&
                        (r = i.vertexes[0]),
                    t.projectPoint2Polygon(e, r, n)
                  );
                },
              },
              {
                key: "projectPoint2Polygon",
                value: function (e, i, n) {
                  return t.isPointInPolygon(e, i, n)
                    ? [0, t.formatPoint(e)]
                    : t.projectPoint2PolygonEdge(e, i, n);
                },
              },
              {
                key: "projectPoint2PolygonEdge",
                value: function (e, i, n) {
                  var s = Number.MAX_VALUE,
                    o = void 0,
                    a = t.formatPolygon(i, n),
                    h = t.formatPoint(e);
                  if (!h || !a) return [s, o];
                  for (var l = 0, c = a.length - 1; l < a.length; c = l++) {
                    var u = a[l],
                      f = a[c],
                      d = t.projectPoint2Segment(h, u, f);
                    s > d[0] && ((s = d[0]), (o = d[1]));
                  }
                  return [(s = r.Numerical.toFixed(s, 2)), o];
                },
              },
              {
                key: "projectPoint2Path",
                value: function (e, i, s) {
                  var r =
                    arguments.length > 3 && void 0 !== arguments[3]
                      ? arguments[3]
                      : "region";
                  e.z = i;
                  for (
                    var o = [],
                      a = Number.MAX_VALUE,
                      h = void 0,
                      l = void 0,
                      c = 0;
                    c < s.length;
                    c++
                  )
                    if (i === s[c][r])
                      if (s[c + 1] && s[c + 1][r] === s[c][r]) {
                        var u = t.projectPoint2Segment(e, s[c], s[c + 1]),
                          f = n(u, 2),
                          d = f[0],
                          v = f[1];
                        d < a && ((h = v), (a = d), (o = [c, c + 1]));
                      } else {
                        var p = t.euclideanDistance(e, s[c]);
                        p < a &&
                          ((a = p),
                          (l = void 0 !== s[c].type ? s[c].type : -1),
                          (h = s[c]),
                          (o = [c]));
                      }
                    else if (
                      "z" === r &&
                      s[c + 1] &&
                      (i - s[c + 1].z) * (i - s[c].z) < 0
                    ) {
                      var y = t.projectPoint2Segment(e, s[c], s[c + 1]),
                        m = n(y, 2),
                        g = m[0],
                        x = m[1];
                      g < a && g < 12 && ((h = x), (a = g), (o = [c, c + 1]));
                    }
                  return [
                    a,
                    h
                      ? {
                          x: h.x,
                          y: h.y,
                          region: s[o[0]].region,
                          z: s[o[0]].z,
                          buildingCode: s[o[0]].buildingCode,
                          type: l,
                        }
                      : void 0,
                    o,
                  ];
                },
              },
              {
                key: "pathRouteDistance",
                value: function (e, i, n, s, r) {
                  (n = parseInt(n)), (r = parseInt(r));
                  var o =
                      0 === n
                        ? e[0]
                        : t.projectPoint2Segment(i, e[n - 1], e[n])[1],
                    a =
                      0 === r
                        ? e[0]
                        : t.projectPoint2Segment(s, e[r - 1], e[r])[1],
                    h = void 0;
                  if (n === r) h = t.euclideanDistance(o, a);
                  else if (n < r)
                    if (o.z !== a.z) h = 0;
                    else {
                      h =
                        t.euclideanDistance(o, e[n]) +
                        t.euclideanDistance(a, e[r - 1]);
                      for (var l = n; l < r - 1; l++)
                        h += t.euclideanDistance(e[l], e[l + 1]);
                    }
                  else if (o.z !== a.z) h = Number.MAX_VALUE;
                  else {
                    h =
                      t.euclideanDistance(o, e[n - 1]) +
                      t.euclideanDistance(a, e[r]);
                    for (var c = r; c < n - 1; c++)
                      h += t.euclideanDistance(e[c], e[c + 1]);
                  }
                  return [h, Math.abs(h - t.euclideanDistance(i, s))];
                },
              },
              {
                key: "checkAlongPath",
                value: function (e, i, n, s, r) {
                  return (n = parseInt(n)) === (r = parseInt(r))
                    ? t.euclideanDistance(i, e[n]) >=
                        t.euclideanDistance(s, e[n])
                    : n < r;
                },
              },
              {
                key: "geoJsonPoint2Road",
                value: function (e, i) {
                  if (
                    "LineString" === i.type ||
                    (2 === i.coordinates.length &&
                      i.coordinates[0][0].constructor !== Array)
                  )
                    return t.geoJsonPoint2Segment(
                      e,
                      i.coordinates[0],
                      i.coordinates[1],
                    );
                  if (t.geoJsonIsPointInPolygon(e, i.coordinates[0])) {
                    if (i.coordinates.length > 1)
                      for (var n = 1; n < i.coordinates.length; n++)
                        if (t.geoJsonIsPointInPolygon(e, i.coordinates[n]))
                          return t.geoJsonPoint2PolygonEdge(
                            e,
                            i.coordinates[n],
                          );
                    return [0, e];
                  }
                  return t.geoJsonPoint2PolygonEdge(e, i.coordinates[0]);
                },
              },
              {
                key: "geoJsonPoint2Segment",
                value: function (e, i, n) {
                  var s =
                    (e.x - i[0]) * (n[0] - i[0]) + (e.y - i[1]) * (n[1] - i[1]);
                  if (s <= 0) return [t.euclideanDistance(e, i), i, 0];
                  var r = Math.pow(n[0] - i[0], 2) + Math.pow(n[1] - i[1], 2);
                  if (s >= r) return [t.euclideanDistance(e, n), n, 2];
                  var o = s / r,
                    a = {
                      x: i[0] + o * (n[0] - i[0]),
                      y: i[1] + o * (n[1] - i[1]),
                    };
                  return [t.euclideanDistance(e, a), a, 1];
                },
              },
              {
                key: "geoJsonIsPointInPolygon",
                value: function (e, i) {
                  for (
                    var n = !1, s = 0, r = i.length - 1;
                    s < i.length;
                    r = s++
                  ) {
                    var o = i[s][0],
                      a = i[s][1],
                      h = i[r][0],
                      l = i[r][1];
                    if (t.geoJsonPoint2Segment(e, i[s], i[r])[0] < 1e-8)
                      return !0;
                    a > e.y != l > e.y &&
                      e.x < ((h - o) * (e.y - a)) / (l - a) + o &&
                      (n = !n);
                  }
                  return n;
                },
              },
              {
                key: "geoJsonPoint2PolygonEdge",
                value: function (e, i) {
                  for (
                    var n = Number.MAX_VALUE,
                      s = void 0,
                      o = 0,
                      a = i.length - 1;
                    o < i.length;
                    a = o++
                  ) {
                    var h = i[o],
                      l = i[a],
                      c = t.geoJsonPoint2Segment(e, h, l);
                    c < n && ((n = c[0]), (s = c[1]));
                  }
                  return [(n = r.Numerical.toFixed(n, 2)), s];
                },
              },
            ]),
            t
          );
        })();
      e.Geometric = a;
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 });
      var n = function t() {
        !(function (t, e) {
          if (!(t instanceof e))
            throw new TypeError("Cannot call a class as a function");
        })(this, t);
      };
      (n.toFixed = function (t, e) {
        var i = 0;
        try {
          i = t.toFixed(e);
        } catch (t) {}
        return parseFloat(i);
      }),
        (n.RAD2DEG = 180 / Math.PI),
        (n.DEG2RAD = Math.PI / 180),
        (n.rad2deg = function (t) {
          return (t * n.RAD2DEG).toFixed(1);
        }),
        (n.deg2rad = function (t) {
          return (t * n.DEG2RAD).toFixed(3);
        }),
        (e.Numerical = n);
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 });
      var s =
        "function" == typeof Symbol && "symbol" == n(Symbol.iterator)
          ? function (t) {
              return n(t);
            }
          : function (t) {
              return t &&
                "function" == typeof Symbol &&
                t.constructor === Symbol &&
                t !== Symbol.prototype
                ? "symbol"
                : n(t);
            };
      e.default = function t(e) {
        var i = void 0;
        if ("object" === (void 0 === e ? "undefined" : s(e)))
          if (Array.isArray(e)) for (var n in ((i = []), e)) i[n] = t(e[n]);
          else if (null === e) i = null;
          else if (e.constructor === RegExp) i = e;
          else for (var r in ((i = {}), e)) i[r] = t(e[r]);
        else i = e;
        return i;
      };
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.HMMUtils = e.HmmHelper = e.RoadType = e.Road = e.Point = void 0);
      var n,
        s = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        r = (n = i(5)) && n.__esModule ? n : { default: n },
        o = i(3);
      function a(t, e) {
        if (!(t instanceof e))
          throw new TypeError("Cannot call a class as a function");
      }
      var h = function t() {
        a(this, t);
      };
      (h.point2PathDistance = function (t, e) {
        for (
          var i =
              arguments.length > 2 && void 0 !== arguments[2]
                ? arguments[2]
                : "region",
            n = [],
            s = Number.MAX_VALUE,
            r = void 0,
            a = "z" !== i,
            h = 0;
          h < e.length;
          h++
        )
          if (t[i] === e[h][i]) {
            var c = new l(t.x, t.y, t.region);
            c.z = t.z;
            var u = new l(e[h].x, e[h].y, e[h].region);
            if (((u.z = e[h].z), e[h + 1] && e[h + 1][i] === e[h][i])) {
              var f = new l(e[h + 1].x, e[h + 1].y, e[h + 1].region);
              f.z = e[h + 1].z;
              var d = o.Geometric.projectPoint2Segment(c, u, f);
              d[0] < s &&
                ((s = d[0]),
                (r = {
                  x: d[1].x,
                  y: d[1].y,
                  region: e[h].region,
                  z: e[h].z,
                  buildingCode: e[h].buildingCode,
                }),
                (n = [h, h + 1]));
            } else {
              var v = o.Geometric.euclideanDistance(c, u);
              if (v < s) {
                s = v;
                var p = -1,
                  y = e[h].type;
                void 0 !== y && (p = y),
                  (r = {
                    x: u.x,
                    y: u.y,
                    region: e[h].region,
                    z: e[h].z,
                    buildingCode: e[h].buildingCode,
                    type: p,
                  }),
                  (n = [h]);
              }
            }
          } else if (!a && e[h + 1]) {
            var m = e[h].z,
              g = e[h + 1].z,
              x = t.z;
            if ((g - x) * (x - m) > 0) {
              var b = new l(t.x, t.y, t.region);
              b.z = 0;
              var k = new l(e[h].x, e[h].y, e[h].region);
              k.z = 0;
              var T = new l(e[h + 1].x, e[h + 1].y, e[h + 1].region);
              T.z = 0;
              var P = o.Geometric.projectPoint2Segment(b, k, T);
              P[0] < s &&
                P[0] < 12 &&
                ((s = P[0]),
                (r = {
                  x: P[1].x,
                  y: P[1].y,
                  region: t.region,
                  z: t.z,
                  buildingCode: t.buildingCode,
                }),
                (n = [h, h + 1]));
            }
          }
        return [s, r, n];
      }),
        (h.point2SegmentDistance = function (t, e, i) {
          var n =
            (t.x - e.x) * (i.x - e.x) +
            (t.y - e.y) * (i.y - e.y) +
            (t.z - e.z) * (i.z - e.z);
          if (n <= 0) return [o.Geometric.euclideanDistance(t, e), e, 0];
          var s = Math.pow(o.Geometric.euclideanDistance(e, i), 2);
          if (n >= s) return [o.Geometric.euclideanDistance(t, i), i, 2];
          var r = n / s,
            a = new l(
              e.x + r * (i.x - e.x),
              e.y + r * (i.y - e.y),
              e.z + r * (i.z - e.z),
            );
          return [o.Geometric.euclideanDistance(t, a), a, 1];
        });
      var l = (function () {
          function t(e, i, n, s, r, o, h, l) {
            a(this, t),
              (this.x = e),
              (this.y = i),
              (this.z = n),
              (this.re = n),
              (this.ne = s),
              (this.type = r),
              (this.cost = o),
              (this.factor = void 0 === h ? {} : h),
              (this.special = l);
          }
          return (
            s(t, [
              {
                key: "isSameRegionWithRoad",
                value: function (t, e) {
                  var i = t.intersections[0];
                  return this.z === e[i].z;
                },
              },
            ]),
            t
          );
        })(),
        c = { LINE: 1, POLYGON: 2, MULTIPOLYGON: 3 },
        u = (function () {
          function t(e, i) {
            var n =
                arguments.length > 2 && void 0 !== arguments[2]
                  ? arguments[2]
                  : [],
              s = arguments[3],
              o = arguments[4],
              h = arguments[5];
            a(this, t),
              (this.isOneWay = e || !1),
              (this.factor = void 0 === s ? 1 : s),
              (this.vertexes = (0, r.default)(i)),
              (this.buildingCode = (0, r.default)(o) || ""),
              (this.mode = h),
              i[0].constructor === Array
                ? (this.type = c.MULTIPOLYGON)
                : i.length > 2
                  ? (this.type = c.POLYGON)
                  : (this.type = c.LINE),
              (this.hasWidth = this.type !== c.LINE),
              this.hasWidth
                ? ((this.isOneWay = !1),
                  (this.intersections = (0, r.default)(n)))
                : (this.intersections = (0, r.default)(i));
          }
          return (
            s(t, [
              {
                key: "isValidLine",
                value: function (t, e, i) {
                  if (!this.hasWidth) return !1;
                  var n = function (t, e) {
                      return function (i, n) {
                        if (t.x - e.x == 0 && t.y - e.y == 0) {
                          var s = 0.01 * (n - e.y);
                          return Math.abs(s) > 0.01 ? s : 0;
                        }
                        var r =
                          (n - e.y) * (t.x - e.x) - (i - e.x) * (t.y - e.y);
                        return Math.abs(r) > 0.01 ? r : 0;
                      };
                    },
                    s = function (t, e, i, s) {
                      var r = n(i, s);
                      if (
                        Math.abs(r(t.x, t.y)) < 1e-8 &&
                        Math.abs(r(e.x, e.y)) < 1e-8
                      ) {
                        var o = void 0,
                          a = void 0,
                          h = void 0,
                          l = void 0,
                          c = void 0;
                        Math.abs(t.x - e.x) > Math.abs(t.y - e.y)
                          ? ((o = Math.min(t.x, e.x)),
                            (a = Math.max(t.x, e.x)),
                            (h = Math.min(i.x, s.x)),
                            (l = Math.max(i.x, s.x)),
                            (c = Math.abs(t.x - e.x)))
                          : ((o = Math.min(t.y, e.y)),
                            (a = Math.max(t.y, e.y)),
                            (h = Math.min(i.y, s.y)),
                            (l = Math.max(i.y, s.y)),
                            (c = Math.abs(t.y - e.y)));
                        var u = Math.max(o, h),
                          f = Math.min(a, l);
                        return u >= f ? 3 : f - u >= c - 0.001 ? 1 : 2;
                      }
                      return 3;
                    },
                    r = void 0;
                  for (var a in (this.type === c.POLYGON
                    ? (r = [this.vertexes])
                    : this.type === c.MULTIPOLYGON && (r = this.vertexes),
                  r))
                    for (var h = r[a].length, u = 0, f = h - 1; u < h; f = u++)
                      switch (s(t, e, i[r[a][u]], i[r[a][f]])) {
                        case 1:
                          return !0;
                        case 2:
                          return !1;
                      }
                  var d,
                    v,
                    p,
                    y,
                    m,
                    g,
                    x,
                    b,
                    k,
                    T,
                    P = new l((t.x + e.x) / 2, (t.y + e.y) / 2, t.z),
                    M = !0;
                  for (var S in r) {
                    for (
                      var _ = r[S].length, O = 0, I = _ - 1;
                      O < _;
                      I = O++
                    ) {
                      if (
                        ((p = i[r[S][O]]),
                        (y = i[r[S][I]]),
                        (m = void 0),
                        (b = void 0),
                        (g = (m = n((d = t), (v = e)))(p.x, p.y)),
                        (x = m(y.x, y.y)),
                        (k = (b = n(p, y))(d.x, d.y)),
                        (T = b(v.x, v.y)),
                        !(
                          o.Geometric.euclideanDistance(d, p) < 0.15 ||
                          o.Geometric.euclideanDistance(v, p) < 0.15 ||
                          o.Geometric.euclideanDistance(d, y) < 0.15 ||
                          o.Geometric.euclideanDistance(v, y) < 0.15
                        ) &&
                          ((Math.abs(g) < 0.01 && k * T <= 0) ||
                            (Math.abs(x) < 0.01 && k * T <= 0) ||
                            (g * x < 0 && k * T < 0)))
                      ) {
                        M = !1;
                        break;
                      }
                    }
                    if (
                      !(M =
                        M &&
                        o.Geometric.isPointInPolygon(P, r[S], i) === (0 == S))
                    )
                      return !1;
                  }
                  return !0;
                },
              },
              {
                key: "distanceWithPoint",
                value: function (t, e) {
                  return o.Geometric.projectPoint2Road(t, this, e);
                },
              },
              {
                key: "angle_to",
                value: function (t, e) {
                  if (this.hasWidth || t.hasWidth) return null;
                  var i =
                      e[this.vertexes[this.vertexes.length - 1]].x -
                      e[this.vertexes[0]].x,
                    n =
                      e[this.vertexes[this.vertexes.length - 1]].y -
                      e[this.vertexes[0]].y,
                    s =
                      e[t.vertexes[t.vertexes.length - 1]].x -
                      e[t.vertexes[0]].x,
                    r =
                      e[t.vertexes[t.vertexes.length - 1]].y -
                      e[t.vertexes[0]].y;
                  return o.Geometric.angleBetweenVectors([i, n], [s, r]);
                },
              },
              {
                key: "angleWith",
                value: function (t, e) {
                  if (this.hasWidth) return null;
                  var i =
                      e[this.vertexes[this.vertexes.length - 1]].x -
                      e[this.vertexes[0]].x,
                    n =
                      e[this.vertexes[this.vertexes.length - 1]].y -
                      e[this.vertexes[0]].y;
                  return o.Geometric.angleBetweenVectors(
                    [Math.sin(t), Math.cos(t)],
                    [i, n],
                  );
                },
              },
            ]),
            t
          );
        })(),
        f = function t() {
          a(this, t);
        };
      (f.findAllShortestDistance2 = function (t, e, i, n) {
        for (var s in t) {
          var r = t[(s = parseInt(s))];
          for (var a in ((e[s] = new l(r.x, r.y, r.z)), r.ne)) {
            var h = r.ne[a],
              c = new u(!0, [s, h]);
            i.push(c);
          }
        }
        for (var f = 0; f < e.length; f++) {
          for (var d = [], v = 0; v < e.length; v++)
            d[v] = f !== v ? Number.MAX_VALUE : 0;
          n[f] = d;
        }
        for (var p in i) {
          var y = i[p],
            m = e[y.vertexes[0]],
            g = e[y.vertexes[1]],
            x = o.Geometric.euclideanDistance(m, g);
          (n[y.vertexes[0]][y.vertexes[1]] = x),
            y.isOneWay || (n[y.vertexes[1]][y.vertexes[0]] = x);
        }
        for (var b = 0; b < e.length; b++)
          for (var k = 0; k < e.length; k++)
            for (var T = 0; T < e.length; T++)
              n[k][T] > n[k][b] + n[b][T] && (n[k][T] = n[k][b] + n[b][T]);
        for (var P = 0; P < e.length; P++)
          for (var M = 0; M < e.length; M++) n[P][M] > 20 && (n[P][M] = 99999);
      }),
        (e.Point = l),
        (e.Road = u),
        (e.RoadType = c),
        (e.HmmHelper = h),
        (e.HMMUtils = f);
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.LocationInterface = void 0);
      var s = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        r = i(12),
        o = i(8),
        a = i(0),
        h = i(56),
        l = i(20),
        c = (function (t) {
          function e(t) {
            !(function (t, e) {
              if (!(t instanceof e))
                throw new TypeError("Cannot call a class as a function");
            })(this, e);
            var i = (function (t, e) {
              if (!t)
                throw new ReferenceError(
                  "this hasn't been initialised - super() hasn't been called",
                );
              return !e || ("object" != n(e) && "function" != typeof e) ? t : e;
            })(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this));
            if (
              ((t = t || {}),
              (i._sensorManager = t.sensorManager || {}),
              (t.locateOptions = t.locateOptions || {}),
              "deviceType" in t.locateOptions)
            )
              i.deviceType = t.locateOptions.deviceType;
            else {
              var s =
                "isIOS" in t
                  ? t.locateOptions.isIOS
                  : !!navigator.userAgent.match(
                      /\(i[^;]+;( U;)? CPU.+Mac OS X/,
                    );
              i.deviceType = s
                ? a.CONSTANTS.DEVICE.IOS
                : a.CONSTANTS.DEVICE.ANDROID;
            }
            return (
              (t.locateOptions.deviceType = i.deviceType),
              (i.locationEngine = new r.LocationEngine(t.locateOptions)),
              i._defSensorEvtHandlerFunc(),
              i._registerSensorEvent(!0),
              i._initLocationEngineEvtHandler(),
              (i._gpsStartTimer = void 0),
              i._sensorManager.beaconSensor &&
                i._sensorManager.beaconSensor.start().then(function () {}),
              i
            );
          }
          return (
            (function (t, e) {
              if ("function" != typeof e && null !== e)
                throw new TypeError(
                  "Super expression must either be null or a function, not " +
                    n(e),
                );
              (t.prototype = Object.create(e && e.prototype, {
                constructor: {
                  value: t,
                  enumerable: !1,
                  writable: !0,
                  configurable: !0,
                },
              })),
                e &&
                  (Object.setPrototypeOf
                    ? Object.setPrototypeOf(t, e)
                    : (t.__proto__ = e));
            })(e, o.DEventDispatcherES6),
            s(e, [
              {
                key: "dispose",
                value: function () {
                  (this.listeners = []),
                    (this.locationEngine.listeners = []),
                    this._registerSensorEvent(!1);
                },
              },
              { key: "reset", value: function () {} },
              {
                key: "loadBuildingInfo",
                value: function (t) {
                  var e = t.buildingCode;
                  this.locationEngine.addAps(t.aps);
                  var i = !1;
                  if (
                    (t.locateOptionsInGraphLayers &&
                      (t.locateOptions = this.paramsTransfer(
                        t.locateOptionsInGraphLayers,
                      )),
                    t.locateOptions &&
                      (this.locationEngine.addLocationOptions(
                        e,
                        t.locateOptions,
                        t.isBuilding,
                      ),
                      (i = !!t.locateOptions.geoActive),
                      t.fpUrl && t.locateOptions.fpActive))
                  ) {
                    var n = void 0;
                    t.fpCoordTransform && (n = t.fpCoordTransform),
                      this.locationEngine.fingerprintsLocation.addFpUrlAndTransform(
                        e,
                        t.fpUrl,
                        n,
                      );
                  }
                  var s = void 0;
                  t.floorBoundaries && (s = t.floorBoundaries),
                    s || console.error(" no floorBoundaries", e),
                    this.locationEngine.loadBuildingArea(e, s, t.isBuilding, i);
                },
              },
              {
                key: "paramsTransfer",
                value: function (t) {
                  var e = {};
                  if (t.layers) {
                    var i = Object.keys(t.layers),
                      n = !0,
                      s = !1,
                      r = void 0;
                    try {
                      for (
                        var o, a = i[Symbol.iterator]();
                        !(n = (o = a.next()).done);
                        n = !0
                      ) {
                        var h = o.value,
                          l = t.layers;
                        if (l[h].features) {
                          var c = l[h].features,
                            u = !0,
                            f = !1,
                            d = void 0;
                          try {
                            for (
                              var v, p = c[Symbol.iterator]();
                              !(u = (v = p.next()).done);
                              u = !0
                            ) {
                              var y = v.value,
                                m = y.properties.name;
                              m &&
                                0 === m.indexOf("fp_") &&
                                (e.fingerprintAreas ||
                                  (e.fingerprintAreas = {}),
                                e.fingerprintAreas[m] ||
                                  (e.fingerprintAreas[m] = []),
                                e.fingerprintAreas[m].push({
                                  polygon: y.geometry.coordinates[0][0],
                                  z: parseFloat(h),
                                })),
                                "slopeRegion" === m
                                  ? (e[m] || (e[m] = []),
                                    e[m].push({
                                      polygon: y.geometry.coordinates[0][0],
                                      z: parseFloat(h),
                                      dir: parseFloat(y.properties.dir),
                                      len: parseFloat(y.properties.len),
                                    }))
                                  : (e[m] || (e[m] = []),
                                    e[m].push({
                                      polygon: y.geometry.coordinates[0][0],
                                      z: parseFloat(h),
                                    }));
                            }
                          } catch (t) {
                            (f = !0), (d = t);
                          } finally {
                            try {
                              !u && p.return && p.return();
                            } finally {
                              if (f) throw d;
                            }
                          }
                        }
                      }
                    } catch (t) {
                      (s = !0), (r = t);
                    } finally {
                      try {
                        !n && a.return && a.return();
                      } finally {
                        if (s) throw r;
                      }
                    }
                  }
                  return Object.assign(t.options ? t.options : {}, e);
                },
              },
              {
                key: "resetLocation",
                value: function () {
                  console.log("reset by outside");
                },
              },
              {
                key: "_defSensorEvtHandlerFunc",
                value: function () {
                  var t = this;
                  (this.bt_statusChanged = function (e) {
                    t.emit("le_btStatusChanged", e);
                  }),
                    (this.bt_scanresult = function (e) {
                      setTimeout(function () {
                        t.emit("le_btScanResult", e);
                      }, 0);
                      var i = t.locationEngine.updateBeaconsLocal(e);
                      i &&
                        i[i.maxZ] &&
                        t.emit("le_btPosition", {
                          value: {
                            type: "btPos",
                            x: i[i.maxZ].x,
                            y: i[i.maxZ].y,
                            z: i.maxZ,
                            timestamp: e.timestamp,
                            confidence: i[i.maxZ].c,
                          },
                        });
                    }),
                    (this.bt_error = function (e) {
                      t.emit("le_btError", e);
                    }),
                    (this.bt_scansuccess = function (e) {
                      t.emit("le_btScanSuccess", e);
                    }),
                    (this.md_sensorAcc = function (e) {
                      if (
                        (t.emit("le_sensorAcc", e),
                        e.value.gravity && e.value.accelerationIncludingGravity)
                      ) {
                        var i = e.value.gravity;
                        t.deviceType === a.CONSTANTS.DEVICE.IOS &&
                          i &&
                          ((i.x = -i.x), (i.y = -i.y), (i.z = -i.z)),
                          t.locationEngine.updateAcc(
                            e.value.timestamp,
                            e.value.accelerationIncludingGravity,
                            i,
                          );
                      }
                    }),
                    (this.md_headingChanged = function (e) {
                      t.locationEngine.updateHeading(e),
                        t.emit("le_orientationChanged", e);
                    }),
                    (this.geo_positionChanged = function (e) {
                      t.locationEngine.updateGeoPosition(e),
                        t.emit("le_geoPositionChanged", e);
                    }),
                    (this.geo_needStartLocate = function (e) {
                      t.emit("le_needStartLocate", e);
                    }),
                    (this.geo_needStopLocate = function (e) {
                      t.emit("le_needStopLocate", e);
                    }),
                    (this.aoa_positionChanged = function (e) {
                      var i = t.locationEngine.updateAoaPosition(e);
                      t.emit("le_aoaPositionChanged", i);
                    });
                },
              },
              {
                key: "_registerSensorEvent",
                value: function (t) {
                  var e = t ? "on" : "off";
                  this._sensorManager.beaconSensor &&
                    (this._sensorManager.beaconSensor[e](
                      "bt_statusChanged",
                      this.bt_statusChanged,
                    ),
                    this._sensorManager.beaconSensor[e](
                      "bt_scanresult",
                      this.bt_scanresult,
                    ),
                    this._sensorManager.beaconSensor[e](
                      "bt_error",
                      this.bt_error,
                    ),
                    this._sensorManager.beaconSensor[e](
                      "bt_scansuccess",
                      this.bt_scansuccess,
                    )),
                    this._sensorManager.accSensor &&
                      this._sensorManager.accSensor[e](
                        "md_sensorAcc",
                        this.md_sensorAcc,
                      ),
                    this._sensorManager.deviceMotionSensor &&
                      this._sensorManager.deviceMotionSensor[e](
                        "md_headingChanged",
                        this.md_headingChanged,
                      ),
                    this._sensorManager.geoSensor &&
                      (this._sensorManager.geoSensor[e](
                        "geo_positionChanged",
                        this.geo_positionChanged,
                      ),
                      this._sensorManager.geoSensor[e](
                        "geo_needStartLocate",
                        this.geo_needStartLocate,
                      ),
                      this._sensorManager.geoSensor[e](
                        "geo_needStopLocate",
                        this.geo_needStopLocate,
                      )),
                    this._sensorManager.aoaLocator &&
                      this._sensorManager.aoaLocator[e](
                        "aoa_positionChanged",
                        this.aoa_positionChanged,
                      );
                },
              },
              {
                key: "_initLocationEngineEvtHandler",
                value: function () {
                  var t = this;
                  this.locationEngine.on("dl_positionChanged", function (e) {
                    t.emit("le_positionChanged", e);
                  }),
                    this.locationEngine.on("dl_stepChanged", function (e) {
                      t.emit("le_stepChanged", e);
                    }),
                    this.locationEngine.on(
                      "dl_exceedPositionLimit",
                      function (e) {
                        t.emit("le_exceedPositionLimit", e);
                      },
                    ),
                    this.locationEngine.on(
                      "dl_fpPositionChanged",
                      function (e) {
                        h.PointDrawer.drawFingerPrint(
                          e.value.x,
                          e.value.y,
                          e.value.confidence,
                          e.value.isUse,
                        ),
                          t.emit("le_fpPositionChanged", e);
                      },
                    ),
                    this.locationEngine.on("le_btPosition", function (e) {
                      h.PointDrawer.drawBtPos(e.value.x, e.value.y, e.value.c),
                        t.emit("le_btPosition", e);
                    });
                },
              },
              {
                key: "startLocate",
                value: function () {
                  this._sensorManager.deviceMotionSensor &&
                    this._sensorManager.deviceMotionSensor.start(),
                    this._sensorManager.accSensor &&
                      this._sensorManager.accSensor.start(),
                    this._sensorManager.beaconSensor &&
                      this._sensorManager.beaconSensor
                        .start()
                        .then(function () {}),
                    this.locationEngine.start();
                },
              },
              {
                key: "stopLocate",
                value: function () {
                  this._sensorManager.beaconSensor &&
                    this._sensorManager.beaconSensor.stop(),
                    this._sensorManager.deviceMotionSensor &&
                      this._sensorManager.deviceMotionSensor.stop(),
                    this._sensorManager.accSensor &&
                      this._sensorManager.accSensor.stop(),
                    this.locationEngine.stop();
                },
              },
              {
                key: "addAps",
                value: function (t) {
                  this.locationEngine.addAps(t);
                },
              },
              {
                key: "setPositionMode",
                value: function (t) {
                  this.locationEngine.setPositionMode(t);
                },
              },
              {
                key: "setDrivingMode",
                value: function () {
                  this.locationEngine.setPositionMode(a.POSITION_MODE.DRIVING);
                },
              },
              {
                key: "setWalkingMode",
                value: function () {
                  this.locationEngine.setPositionMode(a.POSITION_MODE.WALKING);
                },
              },
              {
                key: "setARInitPos",
                value: function (t) {
                  this.locationEngine.startAR(t);
                },
              },
              {
                key: "setARLastPos",
                value: function (t) {
                  this.locationEngine.stopAR(t);
                },
              },
              {
                key: "startAR",
                value: function () {
                  this.locationEngine.ARNavStatus = !0;
                },
              },
              {
                key: "stopAR",
                value: function () {
                  this.locationEngine.ARNavStatus = !1;
                },
              },
              {
                key: "setOutCallingNav",
                value: function (t) {
                  this.locationEngine.outCallingNav(t);
                },
              },
              {
                key: "initHmm",
                value: function (t) {
                  this.locationEngine.initHmm(t);
                },
              },
              {
                key: "enableHMM",
                value: function (t) {
                  this.locationEngine.enableHMM(t);
                },
              },
              {
                key: "getLocationVersion",
                value: function () {
                  var t = "DiffAngle",
                    e =
                      " lic-" +
                      Number(this.locationEngine.ci) +
                      " ap-" +
                      Number(this.locationEngine.bluetoothLocator.ap);
                  return (
                    this.locationEngine &&
                      (this.locationEngine.floorModelMap
                        ? ((t = "mix, current model:"),
                          this.locationEngine.fusionType ===
                          a.CONSTANTS.FUSION_MODEL.PDR
                            ? (t += "pdr+")
                            : (t += "diffAngle"))
                        : this.locationEngine.defaultWlkFusionType ===
                            a.CONSTANTS.FUSION_MODEL.PDR && (t = "pdr+")),
                    "2.8.0 branch:sxd_dev time:2023-08-24 14:51 model type:" +
                      t +
                      " status:" +
                      e
                  );
                },
              },
            ]),
            e
          );
        })();
      (c.axios = l),
        (c.Version = "2.8.0 branch:sxd_dev time:2023-08-24 14:51"),
        (e.LocationInterface = c);
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 });
      var n = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        s = (function () {
          function t() {
            !(function (t, e) {
              if (!(t instanceof e))
                throw new TypeError("Cannot call a class as a function");
            })(this, t),
              (this.listeners = {});
          }
          return (
            n(t, [
              {
                key: "on",
                value: function (t, e) {
                  "function" == typeof e
                    ? (this.listeners[t] || (this.listeners[t] = []),
                      this.listeners[t].indexOf(e) < 0
                        ? this.listeners[t].push(e)
                        : console.warn("listener is already on!"))
                    : console.warn("listener is not function!");
                },
              },
              {
                key: "emit",
                value: function (t) {
                  var e = this.listeners[t],
                    i = Array.prototype.slice.call(arguments);
                  if ((i.shift(), e))
                    for (var n = 0, s = e.length; n < s; n++)
                      e[n].apply(this, i);
                },
              },
              {
                key: "off",
                value: function (t, e) {
                  this.listeners[t]
                    ? void 0 === e
                      ? delete this.listeners[t]
                      : (this.listeners[t] = this.listeners[t].filter(
                          function (t) {
                            return e !== t;
                          },
                        ))
                    : console.log("type not exist!");
                },
              },
              {
                key: "offAllEvents",
                value: function () {
                  this.listeners = [];
                },
              },
            ]),
            t
          );
        })();
      e.DEventDispatcherES6 = s;
    },
    function (t, e) {},
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 });
      var n = i(15);
      Object.defineProperty(e, "Vector", {
        enumerable: !0,
        get: function () {
          return n.Vector;
        },
      });
      var s = i(17);
      Object.defineProperty(e, "Matrix", {
        enumerable: !0,
        get: function () {
          return s.Matrix;
        },
      });
    },
    function (t, e, i) {
      (function (e) {
        var n = i(1),
          s = i(40),
          r = { "Content-Type": "application/x-www-form-urlencoded" };
        function o(t, e) {
          !n.isUndefined(t) &&
            n.isUndefined(t["Content-Type"]) &&
            (t["Content-Type"] = e);
        }
        var a,
          h = {
            adapter:
              (("undefined" != typeof XMLHttpRequest || void 0 !== e) &&
                (a = i(22)),
              a),
            transformRequest: [
              function (t, e) {
                return (
                  s(e, "Content-Type"),
                  n.isFormData(t) ||
                  n.isArrayBuffer(t) ||
                  n.isBuffer(t) ||
                  n.isStream(t) ||
                  n.isFile(t) ||
                  n.isBlob(t)
                    ? t
                    : n.isArrayBufferView(t)
                      ? t.buffer
                      : n.isURLSearchParams(t)
                        ? (o(
                            e,
                            "application/x-www-form-urlencoded;charset=utf-8",
                          ),
                          t.toString())
                        : n.isObject(t)
                          ? (o(e, "application/json;charset=utf-8"),
                            JSON.stringify(t))
                          : t
                );
              },
            ],
            transformResponse: [
              function (t) {
                if ("string" == typeof t)
                  try {
                    t = JSON.parse(t);
                  } catch (t) {}
                return t;
              },
            ],
            timeout: 0,
            xsrfCookieName: "XSRF-TOKEN",
            xsrfHeaderName: "X-XSRF-TOKEN",
            maxContentLength: -1,
            validateStatus: function (t) {
              return t >= 200 && t < 300;
            },
            headers: {
              common: { Accept: "application/json, text/plain, */*" },
            },
          };
        n.forEach(["delete", "get", "head"], function (t) {
          h.headers[t] = {};
        }),
          n.forEach(["post", "put", "patch"], function (t) {
            h.headers[t] = n.merge(r);
          }),
          (t.exports = h);
      }).call(this, i(39));
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.LocationEngine = void 0);
      var s,
        r = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        o = i(8),
        a = i(2),
        h = i(4),
        l = i(26),
        c = i(27),
        u = i(28),
        f = i(29),
        d = i(30),
        v = i(14),
        p = i(32),
        y = (s = i(5)) && s.__esModule ? s : { default: s },
        m = i(0),
        g = i(33),
        x = i(35),
        b = i(7),
        k = (function (t) {
          function e(t) {
            !(function (t, e) {
              if (!(t instanceof e))
                throw new TypeError("Cannot call a class as a function");
            })(this, e);
            var i = (function (t, e) {
              if (!t)
                throw new ReferenceError(
                  "this hasn't been initialised - super() hasn't been called",
                );
              return !e || ("object" != n(e) && "function" != typeof e) ? t : e;
            })(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this));
            t || (t = {});
            var s = (i.t = t.startTime || new Date().getTime());
            return (
              (i.startTime = s),
              (i.isSimulation = !(!("simulation" in t) || !t.simulation)),
              (i.deviceType =
                void 0 !== t.deviceType
                  ? t.deviceType
                  : m.CONSTANTS.DEVICE.MONITOR),
              void 0 === t.deviceType &&
                console.warn("no deviceType, use monitor"),
              (i.locateOptionsMap = {}),
              (i.modelManager = new g.ModelManager(t)),
              (i.roadNetData = new d.RoadNetData(t)),
              (i.hmm = new v.HMM(t)),
              (i.zChecker = new p.ZChecker()),
              (i.bluetoothLocator = new l.BluetoothLocator(t)),
              (i.aoaLocator = new c.AoaLocator(t)),
              (i.motionDetector = new u.MotionDetector(t)),
              (i.areaChecker = new f.AreaChecker(t)),
              (i.fingerprintsLocation = new x.FingerprintsLocation(t)),
              (i.locationTimer = null),
              (i.posMode = m.POSITION_MODE.WALKING),
              (i.phonePlacement = m.CONSTANTS.PHONE_PLACEMENT.HOLD),
              (i.drvMode = m.CONSTANTS.DRIVING_MODE.INDOOR),
              (i.buildingCode = null),
              (i.exceedPositionLimit = !1),
              (i.accuracy = 4),
              (i.fusionType = m.CONSTANTS.FUSION_MODEL.PDR),
              (i.headingSatus = m.CONSTANTS.HEADSTATUS.NORMAL),
              (i.monitorState = 1),
              (i.notifyRenavTime = s),
              (i.navStatus = !1),
              (i.ARNavStatus = !1),
              (i.callNav = void 0),
              (i.paths = null),
              (i.isDirStable = !1),
              (i.reLocation = void 0),
              (i.stepCnt = 0),
              (i.reLocCnt = 0),
              (i.geoBufferCnt = 0),
              (i.btBufferCnt = 0),
              (i.headingDeg = 0),
              (i.kfVelocity = { x: 0, y: 0 }),
              (i.kfHeading = void 0),
              (i.startStableTime = void 0),
              (i.isIndoor = !0),
              (i.isBuilding = !0),
              (i.isStable = !0),
              (i.cnt = 0),
              (i.ci = 1),
              (i.aoaAreas = void 0),
              (i.aoaCnt = 0),
              (i.noAoaCnt = 0),
              (i.stepTimeList = []),
              (i.geoDisableAreas = []),
              (i.geoEnableAreas = []),
              (i.allGeoActive = !1),
              (i.outMapGeoActive = !0),
              (i.inMapGeoActive = !0),
              (i.directReturn = !1),
              (i.defaultZ = 0),
              (i.currentZ = 0),
              i.setParams(t),
              console.log("init location engine"),
              i.reset(),
              i
            );
          }
          return (
            (function (t, e) {
              if ("function" != typeof e && null !== e)
                throw new TypeError(
                  "Super expression must either be null or a function, not " +
                    n(e),
                );
              (t.prototype = Object.create(e && e.prototype, {
                constructor: {
                  value: t,
                  enumerable: !1,
                  writable: !0,
                  configurable: !0,
                },
              })),
                e &&
                  (Object.setPrototypeOf
                    ? Object.setPrototypeOf(t, e)
                    : (t.__proto__ = e));
            })(e, o.DEventDispatcherES6),
            r(e, [
              {
                key: "setParams",
                value: function (t) {
                  t || (t = {}),
                    (this.listTimeLen = 6e3),
                    (this.geoZ = t.geoZ ? t.geoZ : 0),
                    (this.geoActive = void 0 === t.geoActive || t.geoActive),
                    (this.fpActive = void 0 !== t.fpActive && t.fpActive),
                    (this.staticActive =
                      void 0 !== t.staticActive && t.staticActive),
                    (this.stepLen = t.stepLen ? t.stepLen : 0.65),
                    (this.regionStep = t.regionStep),
                    (this.slopeRegion = t.slopeRegion ? t.slopeRegion : void 0),
                    (this.useHMM = void 0 === t.useHMM || t.useHMM),
                    (this.useBtConfidence =
                      void 0 === t.useBtConfidence || t.useBtConfidence),
                    (this.defaultWlkFusionType =
                      void 0 !== t.defaultWlkFusionType
                        ? t.defaultWlkFusionType
                        : m.CONSTANTS.FUSION_MODEL.PDR),
                    (this.floorModelMap = t.floorModelMap
                      ? t.floorModelMap
                      : void 0),
                    (this.drivingGPSRegion = t.drivingGPSRegion
                      ? a.LocationUtils.loadRegionPolygons(t.drivingGPSRegion)
                      : void 0);
                },
              },
              {
                key: "refreshParams",
                value: function (t) {
                  this.setParams(t),
                    this.zChecker.setParams(t),
                    this.bluetoothLocator.setParams(t),
                    this.motionDetector.setParams(t),
                    this.areaChecker.setParams(t),
                    this.aoaLocator.setParams(t),
                    this.fingerprintsLocation.setParams(t.fpLocalizationParams);
                },
              },
              {
                key: "reset",
                value: function () {
                  (this.floorChanged = !1),
                    (this.lastFpZ = void 0),
                    (this.fpZcnt = 0),
                    this.modelManager && this.modelManager.reset(),
                    this.bluetoothLocator && this.bluetoothLocator.reset(),
                    (this.motionState = m.MOTION_STATE.UNCERTAIN),
                    (this.accSensorStatus =
                      m.CONSTANTS.ACC_SENSOR_STATUS.NORMAL),
                    (this.fusionType = m.CONSTANTS.FUSION_MODEL.PDR),
                    (this.stepNum = 0),
                    (this.lastStepTime = 0),
                    (this.stepTurnAngle = 0),
                    (this.btRes = null),
                    (this.btPos = null),
                    (this.fpPos = null),
                    (this.geoPos = null),
                    (this.aoaPos = null),
                    (this.lastValidSignalTime = null),
                    (this.aoaSwitchTime = null),
                    (this.headingFlag = !1),
                    (this.headingChange = 0),
                    (this.changeZtime = null),
                    (this.notifyTime = 0),
                    (this.kfPos = null),
                    (this.checkFloorPos = null),
                    (this.lastNotifyLocPos = void 0),
                    (this.hmmPos = null),
                    (this.hmmDir = null),
                    (this.hmmProb = null),
                    (this.dirAmbiguous = !0),
                    (this.navRes = null),
                    (this.aoaStatus = void 0),
                    console.log("---reset locate engine");
                },
              },
              {
                key: "initHmm",
                value: function (t) {
                  this.loadRoadNet(t);
                },
              },
              {
                key: "loadRoadNet",
                value: function (t) {
                  (t = t || {}),
                    this.roadNetData.loadRoadInfo(t),
                    this.hmm.setRoadNet(this.roadNetData),
                    this.zChecker.setRoadNet(this.roadNetData);
                },
              },
              {
                key: "loadBuildingArea",
                value: function (t, e, i, n, s) {
                  this.areaChecker &&
                    this.areaChecker.loadBuildingArea(t, e, i, n, s);
                },
              },
              {
                key: "changeZ",
                value: function (t) {
                  if (t !== this.currentZ) {
                    var e = this.currentZ;
                    (this.currentZ = t),
                      (this.floorChanged = !0),
                      console.log("floor changed:" + e + "->" + t);
                  }
                },
              },
              {
                key: "updateFusionType",
                value: function () {
                  if (this.posMode === m.POSITION_MODE.DRIVING) {
                    this.setFusionType(m.CONSTANTS.FUSION_MODEL.DIFF);
                    var t =
                      a.LocationUtils.checkInRegion(
                        this.drivingGPSRegion,
                        this.kfPos,
                        this.currentZ,
                      ) || !this.isBuilding
                        ? m.CONSTANTS.DRIVING_MODE.OUTDOOR
                        : m.CONSTANTS.DRIVING_MODE.INDOOR;
                    this.drvMode !== t &&
                      (this.hmm && this.hmm.setParams2posMode(this.posMode, t),
                      this.modelManager.changeState(this.drvMode, t),
                      (this.drvMode = t));
                  } else if (this.posMode === m.POSITION_MODE.WALKING)
                    if (
                      !this.isIndoor ||
                      (this.accSensorStatus >=
                        m.CONSTANTS.ACC_SENSOR_STATUS.NORMAL &&
                        this.headingSatus === m.CONSTANTS.HEADSTATUS.NORMAL)
                    ) {
                      var e = this.getWlkFusionType2Floor();
                      e === m.CONSTANTS.FUSION_MODEL.PDR &&
                        this.fusionType !== m.CONSTANTS.FUSION_MODEL.PDR &&
                        (console.log("change diff to pdr"), this.reset()),
                        this.setFusionType(e);
                    } else this.setFusionType(m.CONSTANTS.FUSION_MODEL.DIFF);
                },
              },
              {
                key: "getWlkFusionType2Floor",
                value: function () {
                  var t = this.defaultWlkFusionType;
                  return (
                    this.floorModelMap &&
                      this.posMode === m.POSITION_MODE.WALKING &&
                      (t =
                        this.currentZ in this.floorModelMap &&
                        this.floorModelMap[this.currentZ] ===
                          m.CONSTANTS.FUSION_MODEL.DIFF
                          ? m.CONSTANTS.FUSION_MODEL.DIFF
                          : m.CONSTANTS.FUSION_MODEL.PDR),
                    t
                  );
                },
              },
              {
                key: "updateBdCodeAndConfig",
                value: function (t) {
                  var e =
                    t.status === m.LOC_AREA_STATUS.UNSET
                      ? this.hmm &&
                        this.hmm.checkExceedPositionLimit(this.kfPos)
                      : t.locStatus === m.LOC_AREA_STATUS.EXCEED;
                  e && !this.exceedPositionLimit
                    ? this.emit("dl_exceedPositionLimit", { value: !0 })
                    : !e &&
                      this.exceedPositionLimit &&
                      this.emit("dl_exceedPositionLimit", { value: !1 }),
                    (this.exceedPositionLimit = e);
                  var i = t.buildingCode;
                  if (
                    ((this.isBuilding = t.isBuilding),
                    (this.isIndoor = t.isIndoor),
                    i && this.buildingCode !== i)
                  ) {
                    console.info(
                      "building code:",
                      this.buildingCode,
                      "-",
                      i,
                      " z",
                      this.currentZ,
                    ),
                      (this.buildingCode = i);
                    var n = this.locateOptionsMap[this.buildingCode];
                    n && this.refreshParams(n),
                      this.fingerprintsLocation.setFpMap(i);
                  }
                },
              },
              {
                key: "updateAccSensorMode",
                value: function () {
                  this.motionDetector
                    ? (this.accSensorStatus =
                        this.motionDetector.getAccSensorStatus())
                    : (this.accSensorStatus =
                        m.CONSTANTS.ACC_SENSOR_STATUS.EMPTY);
                },
              },
              {
                key: "updateZ",
                value: function (t, e) {
                  var i = void 0,
                    n = void 0,
                    s = void 0;
                  if (this.btRes && this.btRes[this.btRes.maxZ]) {
                    (s = this.btRes.maxZ),
                      (i = this.btRes[s]),
                      (n = this.btRes.maxZWeight);
                    var r = this.areaChecker.checkFingerprintFloorArea(i);
                    this.fpPos &&
                      this.fpPos.t > t - 2e3 &&
                      r &&
                      ((i = (0, y.default)(this.fpPos)),
                      (s = this.fpPos.z),
                      this.fpPos.z === this.lastFpZ
                        ? 1 === this.fpPos.c
                          ? (this.fpZcnt += 2)
                          : 2 === this.fpPos.c
                            ? (this.fpZcnt += 1)
                            : (this.fpZcnt += 0.5)
                        : ((this.lastFpZ = this.fpPos.z), (this.fpZcnt = 1)),
                      (n =
                        this.fpZcnt >= 5
                          ? 1.1
                          : this.fpPos.c < 10 ||
                              (this.fpPos.c >= 10 && this.fpZcnt >= 2)
                            ? 0.99
                            : 0.49));
                  }
                  var o = this.zChecker.checkZ(
                      t,
                      e,
                      i,
                      s,
                      n,
                      this.drvMode,
                      this.geoPos,
                      this.isBuilding,
                      this.notifyTime,
                      this.aoaPos,
                      this.lastNotifyLocPos,
                    ),
                    a = o[0];
                  void 0 !== a &&
                    a !== this.currentZ &&
                    (this.changeZ(a),
                    (this.stepTurnAngle = 0),
                    (this.btPos = i),
                    this.resetStateByZ(
                      o[1],
                      this.posMode,
                      this.fusionType,
                      this.drvMode,
                    ));
                },
              },
              {
                key: "getBtPos",
                value: function (t) {
                  if (!this.btRes || this.btRes.t < t - 3e3)
                    this.btPos = void 0;
                  else if (
                    (this.kfPos
                      ? this.btRes[this.currentZ] &&
                        ((this.btPos = this.btRes[this.currentZ]),
                        (this.btPos.t = this.btRes.t),
                        (this.btPos.zWeights = this.btRes.zWeights))
                      : ((this.btPos = this.btRes[this.btRes.maxZ]),
                        (this.btPos.t = this.btRes.t),
                        (this.btPos.zWeights = this.btRes.zWeights)),
                    this.fpPos)
                  ) {
                    var e = !1;
                    this.fpPos.t > t - 1100 &&
                      this.areaChecker.checkFingerprintUseArea(
                        this.fpPos,
                        this.currentZ,
                      ) &&
                      this.fpPos.c < 10 &&
                      (console.log(
                        "use fp",
                        t,
                        "fp delay:",
                        t - this.fpPos.t,
                        "bt delay:",
                        t - this.btRes.t,
                      ),
                      (this.btPos.x = this.fpPos.x),
                      (this.btPos.y = this.fpPos.y),
                      (this.btPos.c = this.fpPos.c),
                      (e = !0)),
                      this.emit("dl_fpPositionChanged", {
                        value: {
                          type: "fpPos",
                          x: this.fpPos.x,
                          y: this.fpPos.y,
                          z: this.fpPos.z,
                          timestamp: this.fpPos.t,
                          confidence: this.fpPos.c,
                          isUse: e,
                        },
                      });
                  }
                  this.changeZtime > t - 6e3 &&
                    this.btPos &&
                    (this.btPos.c = 3);
                },
              },
              {
                key: "resetStateByZ",
                value: function (t, e, i, n) {
                  t &&
                    t[0] &&
                    ((this.kfPos = t[0]),
                    e === m.POSITION_MODE.WALKING &&
                      (i === m.CONSTANTS.FUSION_MODEL.PDR &&
                        this.modelManager.pdrKf &&
                        this.modelManager.pdrKf.setState(t[0]),
                      "straightStairs" === t[1] &&
                        (this.changeZtime = this.t)));
                },
              },
              {
                key: "kfProcess",
                value: function (t, e) {
                  this.kfPos = e.pos;
                  var i = this.getFloorPos();
                  this.updateZ(t, i),
                    (this.kfPos.z = this.currentZ),
                    (this.kfVelocity = e.velocity),
                    (this.kfHeading = e.heading);
                },
              },
              {
                key: "hmmProcess",
                value: function (t, e) {
                  t && t.point
                    ? ((this.hmmPos = t.point),
                      (this.hmmDir = h.Numerical.rad2deg(t.direction)),
                      (this.hmmProb = t.prob),
                      (this.dirAmbiguous = t.ambiguous))
                    : ((this.hmmDir = this.headingDeg),
                      (this.hmmProb = 0.5),
                      (this.hmmPos = e),
                      (this.dirAmbiguous = !0));
                },
              },
              {
                key: "updatePosition",
                value: function (t) {
                  this.updateTime(t),
                    this.getBtPos(t),
                    this.updateFusionType(),
                    this.updateAccSensorMode(),
                    this.checkValidSignal(t);
                  var e = this.headingFlag
                    ? h.Numerical.deg2rad(this.headingDeg)
                    : void 0;
                  (this.bBtConf =
                    this.useBtConfidence && this.currentZ >= this.geoZ),
                    (this.stepLen = this.getAreaL()),
                    this.modelManager.updateFusionModels(
                      t,
                      this.currentZ,
                      this.kfPos,
                      this.btPos,
                      this.geoPos,
                      this.aoaPos,
                      e,
                      this.stepLen,
                      this.stepNum,
                      this.bBtConf,
                      this.isIndoor,
                      this.callNav,
                      this.changeZtime,
                      this.aoaStatus,
                    );
                  var i = this.modelManager.getStates(
                    this.posMode,
                    this.fusionType,
                    this.drvMode,
                  );
                  if ((this.ci || this.isSimulation) && i.pos) {
                    this.kfProcess(t, i), this.checkAoaStatus(t);
                    var n =
                        this.aoaStatus && this.aoaPos
                          ? this.aoaPos
                          : this.kfPos,
                      s = this.compensatePosition(
                        n,
                        this.kfVelocity,
                        this.posMode,
                        this.fusionType,
                        this.deviceType,
                      ),
                      r = this.mapPoint2Road(this.t, n, this.kfPos, e);
                    this.hmmProcess(r, n);
                    var o =
                        this.useHMM && !this.exceedPositionLimit
                          ? this.hmmPos
                          : s,
                      a =
                        this.useHMM && !this.exceedPositionLimit
                          ? this.hmmPos
                          : s,
                      l = m.TRANS_FLOOR_TYPE.NULL,
                      c = this.getEstDirection(),
                      u = r ? r.buildingCode : null,
                      f = this.areaChecker.checkArea(o, this.currentZ, u);
                    this.updateBdCodeAndConfig(f),
                      this.notifyControl(t, o, a, !1, l, c, void 0);
                  }
                },
              },
              {
                key: "notifyControl",
                value: function (t, e, i, n, s, r, o) {
                  var h = t - this.notifyTime;
                  if (this.floorChanged)
                    (this.floorChanged = !1),
                      this.notifyPosition(t, e, i, n, s, r, o);
                  else if (this.posMode === m.POSITION_MODE.DRIVING) {
                    var l =
                      this.kfVelocity.x * this.kfVelocity.x +
                      this.kfVelocity.y * this.kfVelocity.y;
                    ((h > 700 && l > 1) || 0 === this.notifyTime) &&
                      this.notifyPosition(t, e, i, n, s, r, o);
                  } else if (this.posMode === m.POSITION_MODE.WALKING)
                    if (this.fusionType === m.CONSTANTS.FUSION_MODEL.DIFF) {
                      var c =
                        h >= 2e3 &&
                        a.LocationUtils.distance(
                          this.kfPos,
                          this.lastNotifyLocPos,
                        ) >= 3;
                      (this.isStable && 0 !== this.notifyTime && !c) ||
                        (((h > 700 && t - this.lastStepTime <= 1500) ||
                          0 === this.notifyTime ||
                          (h > 700 &&
                            this.accSensorStatus ===
                              m.CONSTANTS.ACC_SENSOR_STATUS.EMPTY) ||
                          (this.deviceType === m.CONSTANTS.DEVICE.MONITOR &&
                            h > 150)) &&
                          this.notifyPosition(t, e, i, n, s, r, o));
                    } else if (
                      this.fusionType === m.CONSTANTS.FUSION_MODEL.PDR
                    ) {
                      var u =
                        h >= 2e3 &&
                        !this.aoaStatus &&
                        a.LocationUtils.distance(
                          this.kfPos,
                          this.lastNotifyLocPos,
                        ) >= 5;
                      this.stepNum > 0 ||
                      0 === this.notifyTime ||
                      u ||
                      this.reLocation
                        ? ((this.reLocation =
                            !this.reLocation && this.reLocation),
                          this.notifyPosition(t, e, i, n, s, r, o))
                        : this.stepNum ||
                          (this.aoaPos &&
                            this.aoaStatus &&
                            this.aoaPos.t - this.notifyTime > 900 &&
                            a.LocationUtils.distance(
                              this.aoaPos,
                              this.lastNotifyLocPos,
                            ) >= 0.3 &&
                            (this.aoaLocator.distSum < 0.5 ||
                              t - this.lastStepTime < 2200) &&
                            this.notifyPosition(t, e, i, n, s, r, o));
                    }
                },
              },
              {
                key: "notifyPosition",
                value: function (t, e, i, n, s, r, o) {
                  (this.cnt += 1),
                    (this.notifyTime = t),
                    (this.lastNotifyLocPos = e),
                    (this.startTime = 1 === this.cnt ? t : this.startTime);
                  var a = !1;
                  n &&
                    t - this.notifyRenavTime > 6e3 &&
                    ((this.notifyRenavTime = t),
                    (a = !0),
                    console.log("re nav", t));
                  var h = {
                    t: t,
                    x: e.x,
                    y: e.y,
                    x_display: i.x,
                    y_display: i.y,
                    vx: this.kfVelocity.x,
                    vy: this.kfVelocity.y,
                    z: this.currentZ,
                    rvID: this.hmm.roadVertexesID,
                    buildingCode: this.buildingCode,
                    isIndoor: this.isIndoor,
                    direction: this.headingDeg,
                    kf_direction: this.kfHeading,
                    display_direction: r,
                    hmmDir: this.hmmDir,
                    hmmProb: this.hmmProb,
                    dirAmbiguous: this.dirAmbiguous,
                    bt_x: this.btPos ? this.btPos.x : void 0,
                    bt_y: this.btPos ? this.btPos.y : void 0,
                    geo_x: this.geoPos ? this.geoPos.x : void 0,
                    geo_y: this.geoPos ? this.geoPos.y : void 0,
                    aoa_x: this.aoaPos ? this.aoaPos.x : void 0,
                    aoa_y: this.aoaPos ? this.aoaPos.y : void 0,
                    aoa_c: this.aoaPos ? this.aoaPos.c : void 0,
                    kf_x: this.kfPos ? this.kfPos.x : void 0,
                    kf_y: this.kfPos ? this.kfPos.y : void 0,
                    navKf_x: o ? o.x : void 0,
                    navKf_y: o ? o.y : void 0,
                    hmm_x: this.hmmPos ? this.hmmPos.x : void 0,
                    hmm_y: this.hmmPos ? this.hmmPos.y : void 0,
                    mapMatchingStatus: !0,
                    pos2PathDis: this.navRes ? this.navRes.dist2Path : void 0,
                    betweenNavPointInfo: this.navRes
                      ? this.navRes.betweenNavPointInfo
                      : void 0,
                    drivingMode: this.drvMode,
                    accuracy: this.accuracy,
                    deviateNaviPath: a,
                    transFloorState: s,
                    exceedPositionLimit: this.exceedPositionLimit,
                  };
                  if (
                    (this.isSimulation && (h = this.getSimData(h)),
                    this.isBuilding ||
                      h.z === this.defaultZ ||
                      ((h.z = this.defaultZ), (this.currentZ = 0)),
                    e)
                  ) {
                    if (!b.LocationInterface.use3857 && !this.isSimulation) {
                      var l = {
                          x0: -2434751.4066697685,
                          y0: 1492767.9076037337,
                          a: 0.1544522917829454,
                          b: -0.17705849662888795,
                        },
                        c = e.x + l.x0 + e.x * l.a - e.y * l.b,
                        u = e.y + l.y0 + e.y * l.a + e.x * l.b,
                        f = T.mercator_decrypt(u, c);
                      (h.x = f.lon), (h.y = f.lat);
                    }
                    this.emit("dl_positionChanged", { value: h });
                  }
                },
              },
              {
                key: "getSimData",
                value: function (t) {
                  return (
                    (t.geo_c =
                      this.geoPos && this.geoPos.c ? this.geoPos.c : null),
                    (t.bt_c = this.btPos && this.btPos.c ? this.btPos.c : null),
                    (t.vx_back = this.kfVelocity.x),
                    (t.vy_back = this.kfVelocity.y),
                    (t.kf_direction_back = h.Numerical.rad2deg(
                      Math.atan2(this.kfVelocity.x, this.kfVelocity.y),
                    )),
                    t
                  );
                },
              },
              {
                key: "checkValidSignal",
                value: function (t) {
                  this.lastValidSignalTime &&
                    t - this.lastValidSignalTime > 15e3 &&
                    (console.warn("no valid signal"),
                    this.extraReset(),
                    (this.cnt = 0),
                    (this.aoaCnt = 0),
                    (this.noAoaCnt = 0),
                    this.modelManager.setNoSignalState()),
                    this.geoPos &&
                      (!this.lastValidSignalTime ||
                        this.geoPos.t > this.lastValidSignalTime) &&
                      (this.lastValidSignalTime = this.geoPos.t);
                  var e = a.LocationUtils.checkInRegion(
                      this.geoDisableAreas,
                      this.geoPos,
                      this.currentZ,
                    ),
                    i = a.LocationUtils.checkInRegion(
                      this.geoEnableAreas,
                      this.geoPos,
                      this.currentZ,
                      this.notifyTime,
                    );
                  e ||
                  !this.allGeoActive ||
                  (this.geoPos &&
                    ((this.geoPos.place === m.LOC_AREA_STATUS.EXCEED &&
                      (!this.outMapGeoActive || this.btPos)) ||
                      (this.geoPos.place !== m.LOC_AREA_STATUS.EXCEED &&
                        !this.inMapGeoActive)))
                    ? (this.geoPos = void 0)
                    : this.geoPos &&
                      (this.exceedPositionLimit ||
                        this.geoPos.place === m.LOC_AREA_STATUS.EXCEED ||
                        this.drvMode === m.CONSTANTS.DRIVING_MODE.OUTDOOR ||
                        (this.geoActive &&
                          (i ||
                            this.geoPos.place !==
                              m.LOC_AREA_STATUS.BUILDING)) ||
                        (this.geoPos = void 0)),
                    this.aoaPos &&
                      (!this.lastValidSignalTime ||
                        this.aoaPos.t > this.lastValidSignalTime) &&
                      (this.lastValidSignalTime = this.aoaPos.t),
                    this.btRes &&
                      (!this.lastValidSignalTime ||
                        this.btRes.t > this.lastValidSignalTime) &&
                      (this.lastValidSignalTime = this.btRes.t);
                },
              },
              {
                key: "compensatePosition",
                value: function (t, e, i, n, s) {
                  var r = (0, y.default)(t);
                  if (n === m.CONSTANTS.FUSION_MODEL.DIFF) {
                    var o;
                    o =
                      s === m.CONSTANTS.DEVICE.MONITOR
                        ? 0.7
                        : s === m.CONSTANTS.DEVICE.IOS
                          ? 1.5
                          : 1;
                    var a = Math.sqrt(e.x * e.x + e.y * e.y),
                      h = 1;
                    a > 10 && (h = 10 / a),
                      (r.x = t.x + e.x * o * h),
                      (r.y = t.y + e.y * o * h);
                  }
                  return r;
                },
              },
              {
                key: "mapPoint2Road",
                value: function (t, e, i, n) {
                  var s = void 0;
                  if (this.hmm) {
                    var r = this.navStatus ? i : e;
                    s = this.hmm.mapMatchingInRealTime(
                      t,
                      r,
                      n,
                      this.motionState,
                    );
                  }
                  return (this.mapMatchingStatus = !0), s;
                },
              },
              {
                key: "getEstDirection",
                value: function () {
                  var t = this.headingDeg;
                  return (
                    ((this.posMode === m.POSITION_MODE.DRIVING &&
                      Math.pow(this.kfVelocity.x, 2) +
                        Math.pow(this.kfVelocity.y, 2) >
                        1) ||
                      this.ARNavStatus) &&
                      (t = this.kfHeading),
                    (((this.posMode === m.POSITION_MODE.DRIVING ||
                      this.ARNavStatus) &&
                      0 === this.hmmDir) ||
                      (this.hmmDir && "NaN" !== this.hmmDir)) &&
                      (t = this.hmmDir),
                    t
                  );
                },
              },
              {
                key: "getFloorPos",
                value: function () {
                  var t = void 0;
                  return (
                    this.checkFloorPos
                      ? ((t = (0, y.default)(this.checkFloorPos)),
                        (this.checkFloorPos = null))
                      : (t = this.kfPos),
                    t
                  );
                },
              },
              {
                key: "updatePhonePlacement",
                value: function (t) {
                  void 0 !== t && (this.phonePlacement = t);
                },
              },
              {
                key: "updateHeading",
                value: function (t) {
                  this.checkMotivationMode(t.timestamp),
                    (this.headingChange = this.headingFlag
                      ? t.value.heading - this.headingDeg
                      : 0),
                    (this.headingDeg = t.value.heading),
                    this.motionDetector.updateHeading(
                      t.timestamp,
                      t.value.heading,
                    ),
                    (this.headingFlag = !0);
                },
              },
              {
                key: "checkMotivationMode",
                value: function (t) {
                  var e = this.isStable;
                  3 === this.stepTimeList.length &&
                    (this.isStable = t - this.stepTimeList[0] >= 2500),
                    !1 === e &&
                      !0 === this.isStable &&
                      (this.startStableTime = t),
                    void 0 === this.startStableTime &&
                      this.bluetoothLocator.firstBeaconsTime &&
                      (this.startStableTime =
                        this.bluetoothLocator.firstBeaconsTime);
                },
              },
              {
                key: "fillStepTimeList",
                value: function (t) {
                  this.stepTimeList.length > 2 && this.stepTimeList.shift(),
                    this.stepTimeList.push(t);
                },
              },
              {
                key: "updateAcc",
                value: function (t, e, i) {
                  var n = this.motionDetector.detectMotion(t, e, i, this.paths);
                  n &&
                    ((this.motionState = n.motionState),
                    n.step &&
                      ((this.stepTurnAngle = n.turnAngle),
                      this.updateStep(n.t, 1),
                      (this.stepCnt += 1),
                      this.emit("dl_stepChanged", {
                        value: { timestamp: n.t, steps: 1 },
                      })),
                    this.updatePhonePlacement(n.phonePlacement));
                },
              },
              {
                key: "updateStep",
                value: function (t, e) {
                  (this.stepNum = e),
                    (this.lastStepTime = t),
                    this.fusionType === m.CONSTANTS.FUSION_MODEL.PDR &&
                      this.updatePosition(t),
                    this.fillStepTimeList(t),
                    (this.stepNum = 0);
                },
              },
              { key: "updateGeoPosition", value: function (t) {} },
              {
                key: "updateAoaPosition",
                value: function (t) {
                  var e = (0, y.default)(t.value);
                  if (a.LocationUtils.checkInRegion(this.aoaAreas, e, e.z)) {
                    var i = e.timestamp || new Date().getTime();
                    this.aoaPos && i - this.aoaPos.t < 3e3
                      ? a.LocationUtils.distance(e, this.aoaPos) < 4 &&
                        this.checkAoaUpdate(e)
                      : this.checkAoaUpdate(e);
                  }
                  return {
                    value: {
                      type: "aoaPos",
                      x: e.x,
                      y: e.y,
                      z: e.z,
                      timestamp: e.t,
                      confidence: e.c,
                    },
                  };
                },
              },
              {
                key: "checkAoaStatus",
                value: function (t) {
                  if (
                    this.cnt > 0 &&
                    this.t - this.startTime < 6200 &&
                    void 0 === this.aoaStatus
                  )
                    this.aoaPos && this.aoaPos.c < 4
                      ? (this.aoaCnt += 1)
                      : (this.noAoaCnt += 1),
                      this.aoaCnt > 3
                        ? (this.aoaStatus = 1)
                        : this.t - this.startTime > 5e3 && (this.aoaStatus = 0),
                      void 0 !== this.aoaStatus &&
                        console.log("初始进入区域", this.aoaStatus);
                  else if (void 0 !== this.aoaStatus) {
                    var e = void 0,
                      i = void 0,
                      n = a.LocationUtils.checkInWhichRegion(
                        this.slopeRegion,
                        this.kfPos,
                        this.currentZ,
                      );
                    if (n > -1)
                      (e = this.slopeRegion[n].dir),
                        this.headingDeg &&
                        Math.abs(
                          a.LocationUtils.angleDiff(this.headingDeg, e),
                        ) < 60
                          ? (i = 1)
                          : this.headingDeg &&
                            Math.abs(
                              a.LocationUtils.angleDiff(
                                this.headingDeg,
                                e - 180,
                              ),
                            ) < 60 &&
                            (i = 0);
                    else if (
                      a.LocationUtils.checkInRegion(
                        this.aoaAreas,
                        this.kfPos,
                        this.currentZ,
                      )
                    )
                      this.aoaPos && t - this.aoaPos.t < 1500
                        ? (i = 1)
                        : !this.aoaStatus &&
                          this.btPos &&
                          this.modelManager.pdrKf.setState(this.btPos);
                    else {
                      var s = 1e5,
                        r = !0,
                        o = !1,
                        h = void 0;
                      try {
                        for (
                          var l,
                            c = [
                              { x: 11601378.094, y: 3633242.95, z: 0 },
                              { x: 11601248.506, y: 3633222.453, z: 0 },
                              { x: 11601378.688, y: 3633242.356, z: 3 },
                              { x: 11601297.045, y: 3633229.968, z: 3 },
                            ][Symbol.iterator]();
                          !(r = (l = c.next()).done);
                          r = !0
                        ) {
                          var u = l.value;
                          if (this.aoaPos && u.z === this.currentZ) {
                            var f = a.LocationUtils.distance(this.aoaPos, u);
                            f < s && (s = f);
                          }
                        }
                      } catch (t) {
                        (o = !0), (h = t);
                      } finally {
                        try {
                          !r && c.return && c.return();
                        } finally {
                          if (o) throw h;
                        }
                      }
                      s < 10 && (i = 0);
                    }
                    void 0 !== i &&
                      i !== this.aoaStatus &&
                      (!this.aoaSwitchTime || t - this.aoaSwitchTime > 12e3) &&
                      (console.log("切换区域", this.aoaStatus, "-", i),
                      (this.aoaStatus = i),
                      (this.aoaSwitchTime = t),
                      this.hmm.reset());
                  }
                },
              },
              {
                key: "checkAoaUpdate",
                value: function (t) {
                  if (
                    ((this.aoaPos = this.aoaLocator.updateAoAPos(
                      t,
                      this.kfPos,
                      this.currentZ,
                      this.aoaStatus,
                    )),
                    (this.aoaPos.t = t.timestamp || new Date().getTime()),
                    this.aoaStatus && !this.isStable)
                  ) {
                    var e = this.headingFlag
                        ? h.Numerical.deg2rad(this.headingDeg)
                        : void 0,
                      i = this.hmm.mapMatchingInRealTime(
                        this.aoaPos.t,
                        t,
                        e,
                        this.motionState,
                      );
                    if (i && i.point) {
                      var n = {
                        t: this.aoaPos.t,
                        x: i.point.x,
                        y: i.point.y,
                        x_display: i.point.x,
                        y_display: i.point.y,
                        vx: this.kfVelocity.x,
                        vy: this.kfVelocity.y,
                        z: this.currentZ,
                        rvID: this.hmm.roadVertexesID,
                        buildingCode: this.buildingCode,
                        isIndoor: this.isIndoor,
                        direction: this.headingDeg,
                        kf_direction: this.kfHeading,
                        display_direction: this.headingDeg,
                        hmmDir: this.hmmDir,
                        hmmProb: this.hmmProb,
                        dirAmbiguous: this.dirAmbiguous,
                        bt_x: this.btPos ? this.btPos.x : void 0,
                        bt_y: this.btPos ? this.btPos.y : void 0,
                        geo_x: this.geoPos ? this.geoPos.x : void 0,
                        geo_y: this.geoPos ? this.geoPos.y : void 0,
                        aoa_x: this.aoaPos ? this.aoaPos.x : void 0,
                        aoa_y: this.aoaPos ? this.aoaPos.y : void 0,
                        aoa_c: this.aoaPos ? this.aoaPos.c : void 0,
                        kf_x: i.point.x,
                        kf_y: i.point.y,
                        hmm_x: i.point.x,
                        hmm_y: i.point.y,
                        exceedPositionLimit: this.exceedPositionLimit,
                      };
                      if (!b.LocationInterface.use3857 && !this.isSimulation) {
                        var s = {
                            x0: -2434751.4066697685,
                            y0: 1492767.9076037337,
                            a: 0.1544522917829454,
                            b: -0.17705849662888795,
                          },
                          r = t.x + s.x0 + t.x * s.a - t.y * s.b,
                          o = t.y + s.y0 + t.y * s.a + t.x * s.b,
                          a = T.mercator_decrypt(o, r);
                        (n.x = a.lon), (n.y = a.lat);
                      }
                      this.emit("dl_positionChanged", { value: n });
                    }
                  }
                },
              },
              {
                key: "addAps",
                value: function (t, e) {
                  t.forEach(function (t) {
                    e && ((t.x -= e.x), (t.y -= e.y));
                  }),
                    this.bluetoothLocator.addAps(t);
                },
              },
              {
                key: "addLocationOptions",
                value: function (t, e, i) {
                  if (e) {
                    var n = e.geoDisableAreas
                      ? a.LocationUtils.loadRegionPolygons(e.geoDisableAreas)
                      : [];
                    this.geoDisableAreas = this.geoDisableAreas.concat(n);
                    var s = e.geoEnableAreas
                      ? a.LocationUtils.loadRegionPolygons(e.geoEnableAreas)
                      : [];
                    s.forEach(function (t) {
                      t && 0 !== t.z && (t.type = "top_open");
                    }),
                      (this.geoEnableAreas = this.geoEnableAreas.concat(s)),
                      (this.allGeoActive =
                        void 0 !== e.allGeoActive
                          ? e.allGeoActive
                          : this.allGeoActive),
                      (this.outMapGeoActive =
                        void 0 !== e.outMapGeoActive
                          ? e.outMapGeoActive
                          : this.outMapGeoActive),
                      (this.inMapGeoActive =
                        void 0 !== e.inMapGeoActive
                          ? e.inMapGeoActive
                          : this.inMapGeoActive),
                      (this.defaultZ =
                        void 0 !== e.defaultZ ? e.defaultZ : this.defaultZ),
                      (this.currentZ = (0, y.default)(this.defaultZ)),
                      (this.deviceType =
                        void 0 !== e.aoaActive
                          ? m.CONSTANTS.DEVICE.MONITOR
                          : this.deviceType),
                      (this.directReturn =
                        void 0 !== e.directReturn
                          ? e.directReturn
                          : this.directReturn),
                      (this.aoaAreas =
                        void 0 !== e.aoaAreas ? e.aoaAreas : this.aoaAreas),
                      this.zChecker.addGeoZAreas(s),
                      this.zChecker.loadZAreas(t, e.zAreas),
                      this.areaChecker.addFingerprintAreas(e.fingerprintAreas),
                      this.areaChecker.loadIndoorAreas(e.indoorAreas),
                      this.areaChecker.loadOutsideAreas(e.outsideAreas),
                      this.areaChecker.loadOutsideAreas(e.outsideArea),
                      this.areaChecker.loadOutsideAreas(s),
                      (this.locateOptionsMap[t] = e),
                      (this.locateOptionsMap.default && i) ||
                        (this.locateOptionsMap.default = e);
                  }
                },
              },
              {
                key: "getFpBeacons",
                value: function (t) {
                  if (this.isStable && this.startStableTime) {
                    var e = Math.max(t - this.startStableTime, 3e3);
                    return this.bluetoothLocator.getCurrentBeacons(e, t);
                  }
                  return this.bluetoothLocator.getCurrentBeacons(3e3, t);
                },
              },
              {
                key: "updateBeaconsLocal",
                value: function (t) {
                  var e = t.timestamp;
                  this.updateMotion(t.motionState),
                    this.bluetoothLocator.updateApsByReceivedBeacons(
                      e,
                      t.value,
                    );
                  var i = this.bluetoothLocator.getCurrentBeacons(5e3, e),
                    n = this.getFpBeacons(e),
                    s = this.bluetoothLocator.calPos(
                      e,
                      i,
                      this.posMode,
                      this.isIndoor,
                      this.kfPos,
                      this.reLocation,
                      this.reLocCnt,
                      this.navStatus,
                    );
                  if (s && s[s.maxZ]) {
                    if (
                      ((this.btRes = s),
                      !this.fingerprintsLocation.startGetFP &&
                        Object.keys(this.fingerprintsLocation.fpCache).length <
                          1)
                    ) {
                      var r = this.areaChecker.checkLocArea(
                        s[s.maxZ],
                        s.maxZ,
                      ).buildingCode;
                      this.fingerprintsLocation.getFingerprintsData(r);
                    }
                    this.updateFpRes(e, n, s),
                      ((this.fusionType === m.CONSTANTS.FUSION_MODEL.DIFF &&
                        s.t > this.t) ||
                        0 === this.notifyTime) &&
                        this.updatePosition(s.t),
                      this.reLocation &&
                        this.isIndoor &&
                        (this.fpPos &&
                        this.areaChecker.checkFingerprintUseArea(
                          this.fpPos,
                          this.currentZ,
                        )
                          ? this.fpPos.c < 5 &&
                            this.fpPos.t > e - 1800 &&
                            this.modelManager.pdrKf.setState(this.fpPos)
                          : this.aoaPos ||
                            (s[this.currentZ] &&
                              s[this.currentZ].c < 2 &&
                              this.modelManager.pdrKf.setState(
                                s[this.currentZ],
                              )));
                  }
                  return s;
                },
              },
              {
                key: "updateFpRes",
                value: function (t, e, i) {
                  if (
                    this.fpActive &&
                    i &&
                    i[i.maxZ] &&
                    this.areaChecker.checkFingerprintStartArea(
                      i[i.maxZ],
                      i.maxZ,
                    ) &&
                    e.length > 0
                  ) {
                    var n = this.fingerprintsLocation.calPosByFingerprint(
                      e,
                      i[i.maxZ],
                    );
                    if (null !== n) {
                      var s = n.pos;
                      this.fpPos = {
                        t: t,
                        x: s[0],
                        y: s[1],
                        z: s[2],
                        c: n.conf,
                      };
                    }
                  }
                },
              },
              {
                key: "updateMotion",
                value: function (t) {
                  void 0 !== t && (this.monitorState = t);
                },
              },
              {
                key: "updateTime",
                value: function (t) {
                  this.t = t;
                },
              },
              {
                key: "start",
                value: function () {
                  var t = this;
                  console.log("start location engine"), this.reset();
                  var e = 0;
                  this.locationTimer = setInterval(function () {
                    var i = new Date().getTime();
                    i - t.t > 990 && t.updatePosition(i),
                      0 == (e = (e + 1) % 2) &&
                        t.motionDetector &&
                        t.motionDetector.checkAccSensorMode(i);
                  }, 1e3);
                },
              },
              {
                key: "stop",
                value: function () {
                  this.locationTimer && clearInterval(this.locationTimer),
                    console.log("stop location engine"),
                    this.reset(),
                    (this.cnt = 0),
                    (this.aoaCnt = 0),
                    (this.noAoaCnt = 0);
                },
              },
              {
                key: "checkReLocation",
                value: function (t) {
                  0 !== this.notifyTime &&
                  void 0 === this.reLocation &&
                  t - this.notifyTime > 4500 &&
                  this.posMode === m.POSITION_MODE.WALKING &&
                  !this.navStatus
                    ? ((this.reLocation = !0),
                      (this.stepCnt = 0),
                      (this.reLocCnt += 1))
                    : this.stepCnt > 5 &&
                      void 0 !== this.reLocation &&
                      ((this.reLocation = void 0), (this.reLocCnt = 0));
                },
              },
              {
                key: "getAreaL",
                value: function () {
                  var t = this.navStatus ? 0.65 : 0.7,
                    e = void 0,
                    i = void 0;
                  return (
                    this.regionStep &&
                      this.regionStep[this.currentZ] &&
                      (t = this.regionStep[this.currentZ]),
                    this.slopeRegion &&
                      this.kfPos &&
                      (i = a.LocationUtils.checkInWhichRegion(
                        this.slopeRegion,
                        this.kfPos,
                        this.currentZ,
                      )) > -1 &&
                      ((e = this.slopeRegion[i].dir),
                      this.headingDeg &&
                        (Math.abs(
                          a.LocationUtils.angleDiff(this.headingDeg, e),
                        ) < 40 ||
                          Math.abs(
                            a.LocationUtils.angleDiff(this.headingDeg, e - 180),
                          ) < 40) &&
                        (t = this.slopeRegion[i].len
                          ? this.slopeRegion[i].len
                          : 0.25)),
                    this.changeZtime > this.t - 6e3 && (t = 0.05),
                    this.ARNavStatus && (t += 0.07),
                    t
                  );
                },
              },
              {
                key: "setFusionType",
                value: function (t) {
                  this.fusionType !== t &&
                    ((this.fusionType = t), console.log("set fusion type", t));
                },
              },
              {
                key: "setPositionMode",
                value: function (t) {
                  t !== this.posMode &&
                    (console.log("change position mode"),
                    this.reset(),
                    this.hmm.reset()),
                    (this.posMode = t),
                    this.hmm.setParams2posMode(this.posMode, this.drvMode),
                    this.zChecker.setParams2posMode(this.posMode);
                },
              },
              {
                key: "startAR",
                value: function (t) {
                  t &&
                    ((this.ARNavStatus = !0), this.modelManager.setLastPos(t));
                },
              },
              {
                key: "stopAR",
                value: function (t) {
                  t &&
                    ((this.ARNavStatus = !1),
                    this.extraReset(),
                    this.modelManager.setLastPos(t));
                },
              },
              {
                key: "extraReset",
                value: function () {
                  this.reset(), this.zChecker.reset();
                },
              },
              {
                key: "enableHMM",
                value: function (t) {
                  this.useHMM = t;
                },
              },
              {
                key: "dispose",
                value: function () {
                  console.log("dispose"),
                    this.reset(),
                    this.hmm && (this.hmm.dispose(), (this.hmm = null)),
                    this.offAllEvents();
                },
              },
            ]),
            e
          );
        })(),
        T = {
          PI: 3.141592653589793,
          x_pi: 52.35987755982988,
          delta: function (t, e) {
            var i = 6378245,
              n = 0.006693421622965943,
              s = this.transformLat(e - 105, t - 35),
              r = this.transformLon(e - 105, t - 35),
              o = (t / 180) * this.PI,
              a = Math.sin(o);
            a = 1 - n * a * a;
            var h = Math.sqrt(a);
            return {
              lat: (s = (180 * s) / (((i * (1 - n)) / (a * h)) * this.PI)),
              lon: (r = (180 * r) / ((i / h) * Math.cos(o) * this.PI)),
            };
          },
          mercator_encrypt: function (t, e) {
            var i = (20037508.34 * e) / 180,
              n =
                Math.log(Math.tan(((90 + t) * this.PI) / 360)) /
                (this.PI / 180);
            return { lat: (n = (20037508.34 * n) / 180), lon: i };
          },
          mercator_decrypt: function (t, e) {
            var i = (e / 20037508.34) * 180,
              n = (t / 20037508.34) * 180;
            return {
              lat: (n =
                (180 / this.PI) *
                (2 * Math.atan(Math.exp((n * this.PI) / 180)) - this.PI / 2)),
              lon: i,
            };
          },
          distance: function (t, e, i, n) {
            var s =
              Math.cos((t * this.PI) / 180) *
                Math.cos((i * this.PI) / 180) *
                Math.cos(((e - n) * this.PI) / 180) +
              Math.sin((t * this.PI) / 180) * Math.sin((i * this.PI) / 180);
            return s > 1 && (s = 1), s < -1 && (s = -1), 6371e3 * Math.acos(s);
          },
          outOfChina: function (t, e) {
            return e < 72.004 || e > 137.8347 || t < 0.8293 || t > 55.8271;
          },
          transformLat: function (t, e) {
            var i =
              2 * t -
              100 +
              3 * e +
              0.2 * e * e +
              0.1 * t * e +
              0.2 * Math.sqrt(Math.abs(t));
            return (
              (i +=
                (2 *
                  (20 * Math.sin(6 * t * this.PI) +
                    20 * Math.sin(2 * t * this.PI))) /
                3),
              (i +=
                (2 *
                  (20 * Math.sin(e * this.PI) +
                    40 * Math.sin((e / 3) * this.PI))) /
                3) +
                (2 *
                  (160 * Math.sin((e / 12) * this.PI) +
                    320 * Math.sin((e * this.PI) / 30))) /
                  3
            );
          },
          transformLon: function (t, e) {
            var i =
              300 +
              t +
              2 * e +
              0.1 * t * t +
              0.1 * t * e +
              0.1 * Math.sqrt(Math.abs(t));
            return (
              (i +=
                (2 *
                  (20 * Math.sin(6 * t * this.PI) +
                    20 * Math.sin(2 * t * this.PI))) /
                3),
              (i +=
                (2 *
                  (20 * Math.sin(t * this.PI) +
                    40 * Math.sin((t / 3) * this.PI))) /
                3) +
                (2 *
                  (150 * Math.sin((t / 12) * this.PI) +
                    300 * Math.sin((t / 30) * this.PI))) /
                  3
            );
          },
        };
      e.LocationEngine = k;
    },
    function (t, e, i) {
      i.r(e),
        i.d(e, "FLOOR", function () {
          return s;
        }),
        i.d(e, "HEIGHT", function () {
          return n;
        });
      var n = { NULL: -1e4, LIFTS: -10001, STAIRS: -10002, ELEVATOR: -10003 },
        s = { LIFTS: -1, STAIRS: -2, ELEVATOR: -3, NULL: -4 };
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }), (e.HMM = void 0);
      var n = function (t, e) {
          if (Array.isArray(t)) return t;
          if (Symbol.iterator in Object(t))
            return (function (t, e) {
              var i = [],
                n = !0,
                s = !1,
                r = void 0;
              try {
                for (
                  var o, a = t[Symbol.iterator]();
                  !(n = (o = a.next()).done) &&
                  (i.push(o.value), !e || i.length !== e);
                  n = !0
                );
              } catch (t) {
                (s = !0), (r = t);
              } finally {
                try {
                  !n && a.return && a.return();
                } finally {
                  if (s) throw r;
                }
              }
              return i;
            })(t, e);
          throw new TypeError(
            "Invalid attempt to destructure non-iterable instance",
          );
        },
        s = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        r = i(6),
        o = i(0),
        a = i(3),
        h = (function () {
          function t(e) {
            !(function (t, e) {
              if (!(t instanceof e))
                throw new TypeError("Cannot call a class as a function");
            })(this, t),
              (e = e || {}),
              (this.roadNetData = {}),
              (this.wlkParams = e.wlkHmmParams
                ? e.wlkHmmParams
                : { sigma: 5, beta: 2, maxDistance: 20 }),
              (this.drvParams = e.drvHmmParams
                ? e.drvHmmParams
                : { sigma: 5, beta: 2, maxDistance: 20 }),
              (this.drvOutParams = e.drvOutHmmParams
                ? e.drvOutHmmParams
                : { sigma: 15, beta: 5, maxDistance: 100 }),
              (this.posMode = o.POSITION_MODE.WALKING),
              (this.drvMode = o.CONSTANTS.DRIVING_MODE.INDOOR),
              (this.sigma = this.wlkParams.sigma || 5),
              (this.beta = this.wlkParams.beta || 2),
              (this.maxDistanceThreshold = this.wlkParams.maxDistance || 20),
              (this.id2Points = []),
              (this.roads = []),
              (this.shortestDis = []),
              (this.transFloorRoads = []),
              this.reset();
          }
          return (
            s(
              t,
              [
                {
                  key: "reset",
                  value: function () {
                    (this.point = void 0),
                      (this.mapPoint = void 0),
                      (this.roadProbs = void 0),
                      (this.roadKey = void 0),
                      (this.dirAmbigious = !0),
                      (this.roadVertexesID = void 0),
                      (this.posList = []);
                  },
                },
                {
                  key: "setParams2posMode",
                  value: function (t, e) {
                    (this.posMode = void 0 !== t ? t : o.POSITION_MODE.WALKING),
                      (this.drvMode =
                        void 0 !== e ? e : o.CONSTANTS.DRIVING_MODE.INDOOR);
                    var i =
                      t === o.POSITION_MODE.WALKING
                        ? this.roadNetData.wlkRoadNet
                        : this.roadNetData.drvRoadNet;
                    i
                      ? ((this.id2Points = i.vertices),
                        (this.roads = i.roads),
                        (this.shortestDis = i.shortestDists),
                        (this.transFloorRoads = i.transFloorRoads))
                      : console.error(
                          "no road net for position mode:",
                          t === o.POSITION_MODE.WALKING ? "walking" : "driving",
                        ),
                      t === o.POSITION_MODE.WALKING
                        ? ((this.sigma = this.wlkParams.sigma || 5),
                          (this.beta = this.wlkParams.beta || 2),
                          (this.maxDistanceThreshold =
                            this.wlkParams.maxDistance || 20))
                        : this.drvMode === o.CONSTANTS.DRIVING_MODE.OUTDOOR
                          ? ((this.sigma = this.drvOutParams.sigma || 15),
                            (this.beta = this.drvOutParams.beta || 5),
                            (this.maxDistanceThreshold =
                              this.drvOutParams.maxDistance || 100))
                          : ((this.sigma = this.drvParams.sigma || 5),
                            (this.beta = this.drvParams.beta || 2),
                            (this.maxDistanceThreshold =
                              this.drvParams.maxDistance || 20));
                  },
                },
                {
                  key: "setRoadNet",
                  value: function (t) {
                    this.roadNetData = t;
                  },
                },
                {
                  key: "minDist2Roads",
                  value: function (t, e) {
                    var i = Number.POSITIVE_INFINITY;
                    for (var n in t) {
                      var s = t[n],
                        r = a.Geometric.projectPoint2Road(
                          e,
                          s,
                          this.id2Points,
                        )[0];
                      r < i && (i = r);
                    }
                    return i;
                  },
                },
                {
                  key: "checkExceedRoadBoundary",
                  value: function (t, e) {
                    if (!e) return !0;
                    var i = Number.POSITIVE_INFINITY;
                    if (void 0 !== t.z && null !== t.z && e[t.z]) {
                      if (e[t.z]) {
                        var n = this.minDist2Roads(e[t.z], t);
                        i = i < n ? i : n;
                      }
                    } else
                      for (var s in e) {
                        var r = this.minDist2Roads(e[s], t);
                        i = i < r ? i : r;
                      }
                    return i > 30;
                  },
                },
                {
                  key: "checkExceedPositionLimit",
                  value: function (t) {
                    var e, i;
                    return (
                      (e =
                        !(!this.roadNetData || !this.roadNetData.wlkRoadNet) ||
                        this.checkExceedRoadBoundary(
                          t,
                          this.roadNetData.wlkRoadNet.roads,
                        )),
                      (i =
                        !(!this.roadNetData || !this.roadNetData.drvRoadNet) ||
                        this.checkExceedRoadBoundary(
                          t,
                          this.roadNetData.drvRoadNet.roads,
                        )),
                      e && i
                    );
                  },
                },
                {
                  key: "measurementProbabilities",
                  value: function (e, i) {
                    var n = [];
                    for (var s in this.roads[e.z]) {
                      var o = this.roads[e.z][s],
                        h = a.Geometric.projectPoint2Road(
                          e,
                          o,
                          this.id2Points,
                        )[0];
                      h < this.maxDistanceThreshold &&
                        (o.type !== r.RoadType.LINE ||
                          (o.type === r.RoadType.LINE &&
                            o.vertexes[0] !==
                              o.vertexes[o.vertexes.length - 1])) &&
                        (n[s] = t.measurementProb(h, this.sigma));
                    }
                    return n;
                  },
                },
                {
                  key: "transitionProbabilities",
                  value: function (e, i, n, s, r, h) {
                    var l = [];
                    for (var c in i)
                      for (var u in s) {
                        var f = t.routeDistance(
                            e,
                            c,
                            n,
                            u,
                            this.roads,
                            this.id2Points,
                            this.shortestDis,
                          ),
                          d = f[0],
                          v = f[1],
                          p = Math.abs(a.Geometric.euclideanDistance(e, n) - d);
                        if (
                          (this.drvMode === o.CONSTANTS.DRIVING_MODE.OUTDOOR ||
                            !(d > 40 || p > 20)) &&
                          ((l[[c, u]] =
                            (1 / this.beta) * Math.exp(-p / this.beta)),
                          h === o.MOTION_STATE.WALKING &&
                            void 0 !== r &&
                            void 0 !== v &&
                            this.posMode === o.POSITION_MODE.WALKING)
                        ) {
                          var y = a.Geometric.angleDiffRad(v, r);
                          l[[c, u]] *= Math.pow(
                            0.5,
                            (3 * Math.abs(y)) / Math.PI,
                          );
                        }
                      }
                    return l;
                  },
                },
                {
                  key: "getBestIdx",
                  value: function (t) {
                    var e = 0,
                      i = -1;
                    for (var n in t) t[n] > e && ((e = t[n]), (i = n));
                    return [i, e];
                  },
                },
                {
                  key: "calHiddenState",
                  value: function (t, e) {
                    for (var i = [], n = void 0, s = t.length - 1; s >= 0; s--)
                      void 0 === n &&
                        Object.keys(t[s]).length > 0 &&
                        (n = this.getBestIdx(t[s])[0]),
                        i.push(n),
                        (n = e[s].hasOwnProperty(n) ? e[s][n] : void 0);
                    return i.reverse(), i;
                  },
                },
                {
                  key: "mapMatchingInRealTime",
                  value: function (e, i, n, s) {
                    if (!i || !this.roads || !this.roads[i.z]) return null;
                    this.point && this.point.z !== i.z && this.reset();
                    var r = void 0,
                      o = void 0,
                      a = void 0;
                    try {
                      if (this.point && this.roadProbs) {
                        (o = this.measurementProbabilities(i)),
                          t.checkBrokenChain(o),
                          (a = t.stateNormalization(o));
                        var h = this.transitionProbabilities(
                            this.point,
                            this.roadProbs,
                            i,
                            a,
                            n,
                            s,
                          ),
                          l = t.viterbi(this.roadProbs, a, h);
                        r = t.stateNormalization(l[1]);
                      } else
                        (o = this.measurementProbabilities(i, void 0)),
                          t.checkBrokenChain(o),
                          (r = t.stateNormalization(o));
                    } catch (e) {
                      console.log(e), (r = t.stateNormalization(a));
                    }
                    return this.calMapResult(e, i, r, n);
                  },
                },
                {
                  key: "mapMatchingDirect",
                  value: function (t) {
                    if (!t || !this.roads || !this.roads[t.z]) return null;
                    var e = 100,
                      i = t,
                      n = {},
                      s = void 0;
                    for (var o in this.roads[t.z]) {
                      var h = this.roads[t.z][o],
                        l = a.Geometric.projectPoint2Road(t, h, this.id2Points);
                      l[0] < e && ((e = l[0]), (i = l[1]), (n = h));
                    }
                    if (n.type === r.RoadType.LINE) {
                      var c = [];
                      for (var u in n.vertexes)
                        if (n.vertexes[u] < 1e4) c[u] = n.vertexes[u];
                        else {
                          var f = n.vertexes[u].toString(),
                            d = f.substr(f.length - 4);
                          c[u] = parseInt(d);
                        }
                      s =
                        c[0] < c[1]
                          ? parseInt(c[0]) + "," + parseInt(c[1])
                          : parseInt(c[1]) + "," + parseInt(c[0]);
                    }
                    return {
                      point: i,
                      roadVertexesID: s,
                      buildingCode: n.buildingCode,
                    };
                  },
                },
                {
                  key: "calMapResult",
                  value: function (t, e, i, s) {
                    if (0 === Object.keys(i).length)
                      return (
                        console.warn("hmm map state empty"), this.reset(), null
                      );
                    var o,
                      h,
                      l = this.getBestIdx(i)[0],
                      c = a.Geometric.projectPoint2Road(
                        e,
                        this.roads[e.z][l],
                        this.id2Points,
                      )[1],
                      u = this.adjustState4doubleRoad(t, e.z, l, c, i, s),
                      f = n(u, 3);
                    if (
                      ((o = f[0]),
                      (i = f[1]),
                      (h = f[2]),
                      (this.roadKey = l),
                      (this.mapPoint = c),
                      (this.point = e),
                      (this.roadProbs = i),
                      this.roads[e.z][l].type === r.RoadType.LINE)
                    ) {
                      var d = [],
                        v = this.roads[e.z][l].vertexes;
                      for (var p in v)
                        if (v[p] < 1e4) d[p] = v[p];
                        else {
                          var y = v[p].toString(),
                            m = y.substr(y.length - 4);
                          d[p] = parseInt(m);
                        }
                      d[0] < d[1]
                        ? (this.roadVertexesID =
                            parseInt(d[0]) + "," + parseInt(d[1]))
                        : (this.roadVertexesID =
                            parseInt(d[1]) + "," + parseInt(d[0]));
                    }
                    return {
                      point: c,
                      prob: i[l],
                      key: l,
                      direction: o,
                      ambiguous: h,
                      buildingCode: this.getBuildingCode(),
                      roadVertexesID: this.roadVertexesID,
                    };
                  },
                },
                {
                  key: "adjustState4doubleRoad",
                  value: function (t, e, i, n, s, o) {
                    var h = this.roads[e][i],
                      l = o,
                      c = !1,
                      u = void 0;
                    if (h.type === r.RoadType.LINE) {
                      u = a.Geometric.vectorDirRad(
                        this.id2Points[h.intersections[0]],
                        this.id2Points[h.intersections[1]],
                      );
                      var f = this.findOppositeRoad(e, i, s);
                      if (
                        ((c = void 0 !== f && Math.abs(s[i] - s[f]) < 0.01),
                        i === this.roadKey)
                      ) {
                        var d = this.id2Points[h.intersections[0]],
                          v =
                            a.Geometric.euclideanDistance(this.mapPoint, d) <=
                            a.Geometric.euclideanDistance(n, d);
                        for (
                          this.posList.push({
                            t: t,
                            dist: a.Geometric.euclideanDistance(
                              n,
                              this.mapPoint,
                            ),
                            dir: v,
                          });
                          this.posList.length > 0 &&
                          t - this.posList[0].t > 1e4;

                        )
                          this.posList.shift();
                      } else this.posList = [];
                      var p = this.calMoveDir(this.posList),
                        y = u;
                      if (-1 === p || 1 === p) {
                        if (-1 === p) {
                          if (
                            (console.warn("调头或者初始反向"), (y = -u), !c)
                          ) {
                            var m = s[i];
                            (s[i] = s[f]), (s[f] = m);
                          }
                          var g = i;
                          (i = f), (f = g);
                        } else 1 === p && (y = u);
                        c &&
                          ((s[i] = s[i] + s[f] - 0.01),
                          (s[f] = 0.01),
                          (c = !1));
                      }
                      s[i] > 0.8
                        ? (this.dirAmbigious = !1)
                        : c && (this.dirAmbigious = !0),
                        (l = this.dirAmbigious ? o : y);
                    }
                    return [l, s, this.dirAmbigious];
                  },
                },
                {
                  key: "calMoveDir",
                  value: function (t) {
                    var e =
                      this.drvMode === o.CONSTANTS.DRIVING_MODE.OUTDOOR
                        ? 30
                        : 15;
                    if (t.length >= 7) {
                      for (var i = 0, n = 0, s = 0; s < t.length; s++)
                        (i += t[s].dist * (t[s].dir ? 1 : -1)),
                          (n += t[s].dist);
                      return i >= e && (n - i) / i <= 0.15
                        ? 1
                        : (i = -i) >= e && (n - i) / i <= 0.15
                          ? -1
                          : 0;
                    }
                    return 0;
                  },
                },
                {
                  key: "findOppositeRoad",
                  value: function (t, e) {
                    var i = this.roads[t][e];
                    e = parseInt(e);
                    var n = void 0;
                    if (i.type === r.RoadType.LINE) {
                      var s = function (t, e, i, n) {
                        return !!(
                          t &&
                          t[e] &&
                          t[e][i] &&
                          t[e][n] &&
                          t[e][i].intersections[0] ===
                            t[e][n].intersections[1] &&
                          t[e][i].intersections[1] === t[e][n].intersections[0]
                        );
                      };
                      0 !== e && s(this.roads, t, e, e - 1)
                        ? (n = e - 1)
                        : s(this.roads, t, e, e + 1) && (n = e + 1);
                    }
                    return n;
                  },
                },
                {
                  key: "getNearestPos",
                  value: function (t) {
                    var e = Number.MAX_VALUE,
                      i = t;
                    for (var n in this.roads[t.z]) {
                      var s = this.roads[t.z][n],
                        r = a.Geometric.projectPoint2Road(t, s, this.id2Points);
                      r[0] < e && ((e = r[0]), (i = r[1]));
                    }
                    return i;
                  },
                },
                {
                  key: "getBuildingCode",
                  value: function () {
                    return this.roads[this.point.z][this.roadKey].buildingCode;
                  },
                },
              ],
              [
                {
                  key: "routeDistance",
                  value: function (e, i, n, s, o, h, l) {
                    var c,
                      u = o[e.z][i],
                      f = o[n.z][s],
                      d = a.Geometric.projectPoint2Road(e, u, h)[1],
                      v = a.Geometric.projectPoint2Road(n, f, h)[1];
                    if (
                      ((c =
                        (u.type === r.RoadType.LINE &&
                          f.type !== r.RoadType.LINE) ||
                        (u.type !== r.RoadType.LINE &&
                          f.type === r.RoadType.LINE)
                          ? Math.atan2(v.x - d.x, v.y - d.y)
                          : u.type === r.RoadType.LINE &&
                              f.type === r.RoadType.LINE
                            ? a.Geometric.vectorDirRad(
                                h[f.intersections[0]],
                                h[f.intersections[1]],
                              )
                            : Math.atan2(v.x - d.x, v.y - d.y)),
                      i === s)
                    )
                      return [a.Geometric.euclideanDistance(d, v), c];
                    var p = u.hasWidth
                        ? u.intersections
                        : [u.intersections[u.intersections.length - 1]],
                      y = f.hasWidth ? f.intersections : [f.intersections[0]],
                      m = Number.MAX_VALUE,
                      g = !0,
                      x = !1,
                      b = void 0;
                    try {
                      for (
                        var k, T = p[Symbol.iterator]();
                        !(g = (k = T.next()).done);
                        g = !0
                      ) {
                        var P = k.value,
                          M = !0,
                          S = !1,
                          _ = void 0;
                        try {
                          for (
                            var O, I = y[Symbol.iterator]();
                            !(M = (O = I.next()).done);
                            M = !0
                          ) {
                            var L,
                              A = O.value;
                            if (
                              void 0 !== (L = t.calShortestDistance(P, A, h))
                            ) {
                              var D =
                                L +
                                a.Geometric.euclideanDistance(d, h[P]) +
                                a.Geometric.euclideanDistance(v, h[A]);
                              m = Math.min(m, D);
                            }
                          }
                        } catch (t) {
                          (S = !0), (_ = t);
                        } finally {
                          try {
                            !M && I.return && I.return();
                          } finally {
                            if (S) throw _;
                          }
                        }
                      }
                    } catch (t) {
                      (x = !0), (b = t);
                    } finally {
                      try {
                        !g && T.return && T.return();
                      } finally {
                        if (x) throw b;
                      }
                    }
                    return [m, c];
                  },
                },
                {
                  key: "measurementProb",
                  value: function (t, e) {
                    var i = 0;
                    return (
                      (i = (1 / e) * Math.exp(-0.5 * Math.pow(t / e, 2))),
                      isNaN(i) && (i = 0),
                      i
                    );
                  },
                },
                {
                  key: "viterbi",
                  value: function (t, e, i) {
                    var n = [],
                      s = [];
                    for (var r in e) {
                      var o = 0,
                        a = void 0;
                      for (var h in t) {
                        var l = t[h] * i[[h, r]] * e[r];
                        o < l && ((o = l), (a = h));
                      }
                      a && ((s[r] = o), (n[r] = a));
                    }
                    return [n, s];
                  },
                },
                {
                  key: "checkBrokenChain",
                  value: function (t) {
                    var e = Object.keys(t);
                    e.sort(function (e, i) {
                      return t[i] - t[e];
                    });
                    var i = e.slice(0, 16);
                    for (var n in t)
                      (t[n] > 1e-20 && i.indexOf(n) >= 0) || delete t[n];
                  },
                },
                {
                  key: "stateNormalization",
                  value: function (t) {
                    var e = t.reduce(function (t, e) {
                      return t + e;
                    }, 0);
                    return t.map(function (t) {
                      return t / e;
                    });
                  },
                },
                {
                  key: "calShortestDistance",
                  value: function (t, e, i) {
                    if (t === e) return 0;
                    var n = i[t],
                      s = i[e],
                      r = a.Geometric.euclideanDistance(n, s);
                    if (!(r >= 20)) {
                      var o = Number.MAX_VALUE;
                      Array.isArray(n.ne) || (n.ne = []);
                      var h = !0,
                        l = !1,
                        c = void 0;
                      try {
                        for (
                          var u, f = n.ne[Symbol.iterator]();
                          !(h = (u = f.next()).done);
                          h = !0
                        ) {
                          var d = u.value;
                          if (d === e) return r;
                          var v = i[d];
                          Array.isArray(v.ne) || (v.ne = []);
                          var p = !0,
                            y = !1,
                            m = void 0;
                          try {
                            for (
                              var g, x = v.ne[Symbol.iterator]();
                              !(p = (g = x.next()).done);
                              p = !0
                            )
                              if (g.value === e) {
                                var b =
                                  a.Geometric.euclideanDistance(n, v) +
                                  a.Geometric.euclideanDistance(v, s);
                                b < o && (o = b);
                                break;
                              }
                          } catch (t) {
                            (y = !0), (m = t);
                          } finally {
                            try {
                              !p && x.return && x.return();
                            } finally {
                              if (y) throw m;
                            }
                          }
                        }
                      } catch (t) {
                        (l = !0), (c = t);
                      } finally {
                        try {
                          !h && f.return && f.return();
                        } finally {
                          if (l) throw c;
                        }
                      }
                      return o < 20 ? o : void 0;
                    }
                  },
                },
              ],
            ),
            t
          );
        })();
      e.HMM = h;
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 });
      var n = i(16),
        s = i(17);
      function r() {}
      (r.prototype = {
        norm: function () {
          for (var t = this.elements.length, e = 0; t--; )
            e += Math.pow(this.elements[t], 2);
          return Math.sqrt(e);
        },
        e: function (t) {
          return t < 1 || t > this.elements.length
            ? null
            : this.elements[t - 1];
        },
        dimensions: function () {
          return { rows: 1, cols: this.elements.length };
        },
        rows: function () {
          return 1;
        },
        cols: function () {
          return this.elements.length;
        },
        modulus: function () {
          return Math.sqrt(this.dot(this));
        },
        eql: function (t) {
          var e = this.elements.length,
            i = t.elements || t;
          if (e != i.length) return !1;
          for (; e--; )
            if (Math.abs(this.elements[e] - i[e]) > n.precision) return !1;
          return !0;
        },
        dup: function () {
          return r.create(this.elements);
        },
        map: function (t) {
          var e = [];
          return (
            this.each(function (i, n) {
              e.push(t(i, n));
            }),
            r.create(e)
          );
        },
        each: function (t) {
          for (var e = this.elements.length, i = 0; i < e; i++)
            t(this.elements[i], i + 1);
        },
        toUnitVector: function () {
          var t = this.modulus();
          return 0 === t
            ? this.dup()
            : this.map(function (e) {
                return e / t;
              });
        },
        angleFrom: function (t) {
          var e = t.elements || t;
          if (this.elements.length != e.length) return null;
          var i = 0,
            n = 0,
            s = 0;
          if (
            (this.each(function (t, r) {
              (i += t * e[r - 1]), (n += t * t), (s += e[r - 1] * e[r - 1]);
            }),
            (n = Math.sqrt(n)),
            (s = Math.sqrt(s)),
            n * s == 0)
          )
            return null;
          var r = i / (n * s);
          return r < -1 && (r = -1), r > 1 && (r = 1), Math.acos(r);
        },
        isParallelTo: function (t) {
          var e = this.angleFrom(t);
          return null === e ? null : e <= n.precision;
        },
        isAntiparallelTo: function (t) {
          var e = this.angleFrom(t);
          return null === e ? null : Math.abs(e - Math.PI) <= n.precision;
        },
        isPerpendicularTo: function (t) {
          var e = this.dot(t);
          return null === e ? null : Math.abs(e) <= n.precision;
        },
        add: function (t) {
          var e = t.elements || t;
          return this.elements.length != e.length
            ? this.map(function (e) {
                return e + t;
              })
            : this.map(function (t, i) {
                return t + e[i - 1];
              });
        },
        subtract: function (t) {
          if ("number" == typeof t)
            return this.map(function (e) {
              return e - t;
            });
          var e = t.elements || t;
          return this.elements.length != e.length
            ? null
            : this.map(function (t, i) {
                return t - e[i - 1];
              });
        },
        multiply: function (t) {
          return this.map(function (e) {
            return e * t;
          });
        },
        prop: function (t) {
          if ("number" == typeof t)
            return this.map(function (e) {
              return e - t;
            });
          var e = t.elements || t;
          return e[0][0] < 1 && e[0][0] > 0
            ? (console.log("随机加密坐标", Math.floor(11 * Math.random()) + 10),
              this.map(function (t, e) {
                return t - Math.floor(11 * Math.random()) + 10;
              }))
            : this.map(function (t, e) {
                return t;
              });
        },
        elementMultiply: function (t) {
          return this.map(function (e, i) {
            return t.e(i) * e;
          });
        },
        sum: function () {
          var t = 0;
          return (
            this.map(function (e) {
              t += e;
            }),
            t
          );
        },
        chomp: function (t) {
          for (var e = [], i = t; i < this.elements.length; i++)
            e.push(this.elements[i]);
          return r.create(e);
        },
        top: function (t) {
          for (var e = [], i = 0; i < t; i++) e.push(this.elements[i]);
          return r.create(e);
        },
        augment: function (t) {
          for (var e = this.elements, i = 0; i < t.length; i++) e.push(t[i]);
          return r.create(e);
        },
        x: function (t) {
          return this.multiply(t);
        },
        log: function () {
          return r.log(this);
        },
        elementDivide: function (t) {
          return this.map(function (e, i) {
            return e / t.e(i);
          });
        },
        product: function () {
          var t = 1;
          return (
            this.map(function (e) {
              t *= e;
            }),
            t
          );
        },
        dot: function (t) {
          var e = t.elements || t,
            i = 0,
            n = this.elements.length;
          if (n != e.length) return null;
          for (; n--; ) i += this.elements[n] * e[n];
          return i;
        },
        cross: function (t) {
          var e = t.elements || t;
          if (3 != this.elements.length || 3 != e.length) return null;
          var i = this.elements;
          return r.create([
            i[1] * e[2] - i[2] * e[1],
            i[2] * e[0] - i[0] * e[2],
            i[0] * e[1] - i[1] * e[0],
          ]);
        },
        max: function () {
          for (var t = 0, e = this.elements.length; e--; )
            Math.abs(this.elements[e]) > Math.abs(t) && (t = this.elements[e]);
          return t;
        },
        maxIndex: function () {
          for (var t = 0, e = this.elements.length, i = -1; e--; )
            Math.abs(this.elements[e]) > Math.abs(t) &&
              ((t = this.elements[e]), (i = e + 1));
          return i;
        },
        indexOf: function (t) {
          for (var e = null, i = this.elements.length, n = 0; n < i; n++)
            null === e && this.elements[n] == t && (e = n + 1);
          return e;
        },
        toDiagonalMatrix: function () {
          return s.Diagonal(this.elements);
        },
        round: function () {
          return this.map(function (t) {
            return Math.round(t);
          });
        },
        transpose: function () {
          for (var t = this.elements.length, e = [], i = 0; i < t; i++)
            e.push([this.elements[i]]);
          return s.create(e);
        },
        snapTo: function (t) {
          return this.map(function (e) {
            return Math.abs(e - t) <= n.precision ? t : e;
          });
        },
        distanceFrom: function (t) {
          if (t.anchor || (t.start && t.end)) return t.distanceFrom(this);
          var e = t.elements || t;
          if (e.length != this.elements.length) return null;
          var i,
            n = 0;
          return (
            this.each(function (t, s) {
              (i = t - e[s - 1]), (n += i * i);
            }),
            Math.sqrt(n)
          );
        },
        liesOn: function (t) {
          return t.contains(this);
        },
        liesIn: function (t) {
          return t.contains(this);
        },
        rotate: function (t, e) {
          var i,
            n,
            o,
            a,
            h = null;
          switch ((t.determinant && (h = t.elements), this.elements.length)) {
            case 2:
              return 2 != (i = e.elements || e).length
                ? null
                : (h || (h = s.Rotation(t).elements),
                  (n = this.elements[0] - i[0]),
                  (o = this.elements[1] - i[1]),
                  r.create([
                    i[0] + h[0][0] * n + h[0][1] * o,
                    i[1] + h[1][0] * n + h[1][1] * o,
                  ]));
            case 3:
              if (!e.direction) return null;
              var l = e.pointClosestTo(this).elements;
              return (
                h || (h = s.Rotation(t, e.direction).elements),
                (n = this.elements[0] - l[0]),
                (o = this.elements[1] - l[1]),
                (a = this.elements[2] - l[2]),
                r.create([
                  l[0] + h[0][0] * n + h[0][1] * o + h[0][2] * a,
                  l[1] + h[1][0] * n + h[1][1] * o + h[1][2] * a,
                  l[2] + h[2][0] * n + h[2][1] * o + h[2][2] * a,
                ])
              );
            default:
              return null;
          }
        },
        reflectionIn: function (t) {
          if (t.anchor) {
            var e = this.elements.slice(),
              i = t.pointClosestTo(e).elements;
            return r.create([
              i[0] + (i[0] - e[0]),
              i[1] + (i[1] - e[1]),
              i[2] + (i[2] - (e[2] || 0)),
            ]);
          }
          var n = t.elements || t;
          return this.elements.length != n.length
            ? null
            : this.map(function (t, e) {
                return n[e - 1] + (n[e - 1] - t);
              });
        },
        to3D: function () {
          var t = this.dup();
          switch (t.elements.length) {
            case 3:
              break;
            case 2:
              t.elements.push(0);
              break;
            default:
              return null;
          }
          return t;
        },
        inspect: function () {
          return "[" + this.elements.join(", ") + "]";
        },
        setElements: function (t) {
          return (this.elements = (t.elements || t).slice()), this;
        },
      }),
        (r.create = function (t) {
          return new r().setElements(t);
        }),
        (r.i = r.create([1, 0, 0])),
        (r.j = r.create([0, 1, 0])),
        (r.k = r.create([0, 0, 1])),
        (r.Random = function (t) {
          for (var e = []; t--; ) e.push(Math.random());
          return r.create(e);
        }),
        (r.Fill = function (t, e) {
          for (var i = []; t--; ) i.push(e);
          return r.create(i);
        }),
        (r.Zero = function (t) {
          return r.Fill(t, 0);
        }),
        (r.One = function (t) {
          return r.Fill(t, 1);
        }),
        (r.log = function (t) {
          return t.map(function (t) {
            return Math.log(t);
          });
        }),
        (e.Vector = r);
    },
    function (t, e, i) {
      t.exports = { precision: 1e-6, approxPrecision: 1e-5 };
    },
    function (t, e, n) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.Matrix = void 0);
      var s,
        r = n(15),
        o = n(9),
        a = n(16);
      function h(t, e, i, n) {
        for (var s = t.elements, r = n - 1; r--; ) {
          for (var o = [], a = 0; a < i; a++) o.push(a == r ? 1 : 0);
          s.unshift(o);
        }
        for (r = n - 1; r < e; r++) for (; s[r].length < i; ) s[r].unshift(0);
        return d.create(s);
      }
      function l() {
        for (
          var t = this,
            e = d.I(t.rows()),
            i = t.transpose(),
            n = d.I(t.cols()),
            s = Number.MAX_VALUE,
            o = 0;
          s > 22737e-17 && o < 100;

        ) {
          var a = i.transpose().qrJs();
          (i = a.R), (e = e.x(a.Q)), (a = i.transpose().qrJs()), (n = n.x(a.Q));
          var h = (i = a.R).triu(1).unroll().norm(),
            l = i.diagonal().norm();
          0 == l && (l = 1), (s = h / l), o++;
        }
        var c = i.diagonal(),
          u = [];
        for (o = 1; o <= c.cols(); o++) {
          var f = c.e(o);
          if ((u.push(Math.abs(f)), f < 0))
            for (var v = 0; v < n.rows(); v++)
              e.elements[v][o - 1] = -e.elements[v][o - 1];
        }
        return { U: n, S: r.Vector.create(u).toDiagonalMatrix(), V: e };
      }
      function c() {
        var t = s.sgesvd("A", "A", this.elements);
        return {
          U: d.create(t.U),
          S: d.create(t.S).column(1).toDiagonalMatrix(),
          V: d.create(t.VT).transpose(),
        };
      }
      function u() {
        for (
          var t = this.rows(), e = this.cols(), i = d.I(t), n = this, s = 1;
          s < Math.min(t, e);
          s++
        ) {
          for (var o = n.slice(s, 0, s, s).col(1), a = [1]; a.length <= t - s; )
            a.push(0);
          a = r.Vector.create(a);
          var l = o.add(a.x(o.norm() * Math.sign(o.e(1)))),
            c = d.create(l),
            u = h(
              d
                .I(t - s + 1)
                .subtract(
                  c.x(2).x(c.transpose()).div(c.transpose().x(c).e(1, 1)),
                ),
              t,
              e,
              s,
            );
          (n = u.x(n)), (i = i.x(u));
        }
        return { Q: i, R: n };
      }
      function f() {
        var t = s.qr(this.elements);
        return { Q: d.create(t.Q), R: d.create(t.R) };
      }
      function d() {}
      function v() {
        var t = s.lu(this.elements);
        return { L: d.create(t.L), U: d.create(t.U), P: d.create(t.P) };
      }
      function p() {
        for (
          var t = this.dup(),
            e = d.I(t.rows()),
            i = d.I(t.rows()),
            n = d.Zeros(t.rows(), t.cols()),
            s = 1,
            r = 1;
          r <= Math.min(t.cols(), t.rows());
          r++
        ) {
          i = t.partialPivot(r, s, i, t, e);
          for (var o = r + 1; o <= t.rows(); o++) {
            var a = t.e(o, s) / t.e(r, s);
            e.elements[o - 1][r - 1] = a;
            for (var h = r + 1; h <= t.cols(); h++)
              t.elements[o - 1][h - 1] -= t.e(r, h) * a;
          }
          for (h = r; h <= t.cols(); h++) n.elements[r - 1][h - 1] = t.e(r, h);
          s < t.cols() && s++;
        }
        return { L: e, U: n, P: i };
      }
      (d.prototype = {
        solve: function (t) {
          var e = this.lu();
          t = e.P.x(t);
          var i = e.L.forwardSubstitute(t),
            n = e.U.backSubstitute(i);
          return e.P.x(n);
        },
        pcaProject: function (t, e) {
          var i,
            n,
            s = (e =
              e ||
              ((i = this),
              (n = i
                .transpose()
                .x(i)
                .x(1 / i.rows())
                .svd()),
              { U: n.U, S: n.S }).U).slice(1, e.rows(), 1, t);
          return { Z: this.x(s), U: e };
        },
        pcaRecover: function (t) {
          var e = this.cols(),
            i = t.slice(1, t.rows(), 1, e);
          return this.x(i.transpose());
        },
        triu: function (t) {
          return (
            t || (t = 0),
            this.map(function (e, i, n) {
              return n - i >= t ? e : 0;
            })
          );
        },
        unroll: function () {
          for (var t = [], e = 1; e <= this.cols(); e++)
            for (var i = 1; i <= this.rows(); i++) t.push(this.e(i, e));
          return r.Vector.create(t);
        },
        slice: function (t, e, n, s) {
          var r = [];
          for (
            0 == e && (e = this.rows()), 0 == s && (s = this.cols()), i = t;
            i <= e;
            i++
          ) {
            var o = [];
            for (j = n; j <= s; j++) o.push(this.e(i, j));
            r.push(o);
          }
          return d.create(r);
        },
        e: function (t, e) {
          return t < 1 ||
            t > this.elements.length ||
            e < 1 ||
            e > this.elements[0].length
            ? null
            : this.elements[t - 1][e - 1];
        },
        row: function (t) {
          return t > this.elements.length
            ? null
            : r.Vector.create(this.elements[t - 1]);
        },
        col: function (t) {
          if (t > this.elements[0].length) return null;
          for (var e = [], i = this.elements.length, n = 0; n < i; n++)
            e.push(this.elements[n][t - 1]);
          return r.Vector.create(e);
        },
        dimensions: function () {
          return { rows: this.elements.length, cols: this.elements[0].length };
        },
        rows: function () {
          return this.elements.length;
        },
        cols: function () {
          return this.elements[0].length;
        },
        approxEql: function (t) {
          return this.eql(t, a.approxPrecision);
        },
        eql: function (t, e) {
          var i = t.elements || t;
          if (
            (void 0 === i[0][0] && (i = d.create(i).elements),
            this.elements.length != i.length ||
              this.elements[0].length != i[0].length)
          )
            return !1;
          for (
            var n, s = this.elements.length, r = this.elements[0].length;
            s--;

          )
            for (n = r; n--; )
              if (Math.abs(this.elements[s][n] - i[s][n]) > (e || a.precision))
                return !1;
          return !0;
        },
        dup: function () {
          return d.create(this.elements);
        },
        map: function (t) {
          for (
            var e,
              i = [],
              n = this.elements.length,
              s = this.elements[0].length;
            n--;

          )
            for (e = s, i[n] = []; e--; )
              i[n][e] = t(this.elements[n][e], n + 1, e + 1);
          return d.create(i);
        },
        isSameSizeAs: function (t) {
          var e = t.elements || t;
          return (
            void 0 === e[0][0] && (e = d.create(e).elements),
            this.elements.length == e.length &&
              this.elements[0].length == e[0].length
          );
        },
        add: function (t) {
          if ("number" == typeof t)
            return this.map(function (e, i, n) {
              return e + t;
            });
          var e = t.elements || t;
          return (
            void 0 === e[0][0] && (e = d.create(e).elements),
            this.isSameSizeAs(e)
              ? this.map(function (t, i, n) {
                  return t + e[i - 1][n - 1];
                })
              : null
          );
        },
        subtract: function (t) {
          if ("number" == typeof t)
            return this.map(function (e, i, n) {
              return e - t;
            });
          var e = t.elements || t;
          return (
            void 0 === e[0][0] && (e = d.create(e).elements),
            this.isSameSizeAs(e)
              ? this.map(function (t, i, n) {
                  return t - e[i - 1][n - 1];
                })
              : null
          );
        },
        canMultiplyFromLeft: function (t) {
          var e = t.elements || t;
          return (
            void 0 === e[0][0] && (e = d.create(e).elements),
            this.elements[0].length == e.length
          );
        },
        prop: function (t) {
          if ("number" == typeof t)
            return this.map(function (e, i, n) {
              return e - t;
            });
          var e = t.elements || t;
          return (
            void 0 === e[0][0] && (e = d.create(e).elements),
            this.isSameSizeAs(e)
              ? this.map(function (t, i, n) {
                  return t - e[i - 1][n - 1];
                })
              : null
          );
        },
        mulOp: function (t, e) {
          if (!t.elements)
            return this.map(function (i) {
              return e(i, t);
            });
          var i = !!t.modulus;
          if (
            (void 0 === (p = t.elements || t)[0][0] &&
              (p = d.create(p).elements),
            !this.canMultiplyFromLeft(p))
          )
            return null;
          for (
            var n,
              s,
              r,
              o,
              a,
              h = this.elements,
              l = [],
              c = h.length,
              u = p[0].length,
              f = h[0].length,
              v = c;
            v--;

          ) {
            for (s = [], n = h[v], o = u; o--; ) {
              for (r = 0, a = f; a--; ) r += e(n[a], p[a][o]);
              s[o] = r;
            }
            l[v] = s;
          }
          var p = d.create(l);
          return i ? p.col(1) : p;
        },
        div: function (t) {
          return this.mulOp(t, function (t, e) {
            return t / e;
          });
        },
        multiply: function (t) {
          return this.mulOp(t, function (t, e) {
            return t * e;
          });
        },
        x: function (t) {
          return this.multiply(t);
        },
        elementMultiply: function (t) {
          return this.map(function (e, i, n) {
            return t.e(i, n) * e;
          });
        },
        sum: function () {
          var t = 0;
          return (
            this.map(function (e) {
              t += e;
            }),
            t
          );
        },
        mean: function () {
          for (var t = this.dimensions(), e = [], i = 1; i <= t.cols; i++)
            e.push(this.col(i).sum() / t.rows);
          return r.Vector.create(e);
        },
        column: function (t) {
          return this.col(t);
        },
        log: function () {
          return this.map(function (t) {
            return Math.log(t);
          });
        },
        minor: function (t, e, i, n) {
          for (
            var s,
              r,
              o,
              a = [],
              h = i,
              l = this.elements.length,
              c = this.elements[0].length;
            h--;

          )
            for (a[(s = i - h - 1)] = [], r = n; r--; )
              (o = n - r - 1),
                (a[s][o] = this.elements[(t + s - 1) % l][(e + o - 1) % c]);
          return d.create(a);
        },
        transpose: function () {
          for (
            var t,
              e = this.elements.length,
              i = [],
              n = this.elements[0].length;
            n--;

          )
            for (t = e, i[n] = []; t--; ) i[n][t] = this.elements[t][n];
          return d.create(i);
        },
        isSquare: function () {
          return this.elements.length == this.elements[0].length;
        },
        max: function () {
          for (
            var t, e = 0, i = this.elements.length, n = this.elements[0].length;
            i--;

          )
            for (t = n; t--; )
              Math.abs(this.elements[i][t]) > Math.abs(e) &&
                (e = this.elements[i][t]);
          return e;
        },
        indexOf: function (t) {
          var e,
            i,
            n = this.elements.length,
            s = this.elements[0].length;
          for (e = 0; e < n; e++)
            for (i = 0; i < s; i++)
              if (this.elements[e][i] == t) return { i: e + 1, j: i + 1 };
          return null;
        },
        diagonal: function () {
          if (!this.isSquare) return null;
          for (var t = [], e = this.elements.length, i = 0; i < e; i++)
            t.push(this.elements[i][i]);
          return r.Vector.create(t);
        },
        toRightTriangular: function () {
          var t,
            e,
            i,
            n,
            s = this.dup(),
            r = this.elements.length,
            o = this.elements[0].length;
          for (e = 0; e < r; e++) {
            if (0 == s.elements[e][e])
              for (i = e + 1; i < r; i++)
                if (0 != s.elements[i][e]) {
                  for (t = [], n = 0; n < o; n++)
                    t.push(s.elements[e][n] + s.elements[i][n]);
                  s.elements[e] = t;
                  break;
                }
            if (0 != s.elements[e][e])
              for (i = e + 1; i < r; i++) {
                var a = s.elements[i][e] / s.elements[e][e];
                for (t = [], n = 0; n < o; n++)
                  t.push(n <= e ? 0 : s.elements[i][n] - s.elements[e][n] * a);
                s.elements[i] = t;
              }
          }
          return s;
        },
        toUpperTriangular: function () {
          return this.toRightTriangular();
        },
        determinant: function () {
          if (!this.isSquare()) return null;
          if (1 == this.cols && 1 == this.rows) return this.row(1);
          if (0 == this.cols && 0 == this.rows) return 1;
          for (
            var t = this.toRightTriangular(),
              e = t.elements[0][0],
              i = t.elements.length,
              n = 1;
            n < i;
            n++
          )
            e *= t.elements[n][n];
          return e;
        },
        det: function () {
          return this.determinant();
        },
        isSingular: function () {
          return this.isSquare() && 0 === this.determinant();
        },
        trace: function () {
          if (!this.isSquare()) return null;
          for (
            var t = this.elements[0][0], e = this.elements.length, i = 1;
            i < e;
            i++
          )
            t += this.elements[i][i];
          return t;
        },
        tr: function () {
          return this.trace();
        },
        rank: function () {
          for (
            var t,
              e = this.toRightTriangular(),
              i = 0,
              n = this.elements.length,
              s = this.elements[0].length;
            n--;

          )
            for (t = s; t--; )
              if (Math.abs(e.elements[n][t]) > a.precision) {
                i++;
                break;
              }
          return i;
        },
        rk: function () {
          return this.rank();
        },
        augment: function (t) {
          var e = t.elements || t;
          void 0 === e[0][0] && (e = d.create(e).elements);
          var i,
            n = this.dup(),
            s = n.elements[0].length,
            r = n.elements.length,
            o = e[0].length;
          if (r != e.length) return null;
          for (; r--; ) for (i = o; i--; ) n.elements[r][s + i] = e[r][i];
          return n;
        },
        inverse: function () {
          if (!this.isSquare() || this.isSingular()) return null;
          for (
            var t,
              e,
              i,
              n,
              s,
              r = this.elements.length,
              o = r,
              a = this.augment(d.I(r)).toRightTriangular(),
              h = a.elements[0].length,
              l = [];
            o--;

          ) {
            for (i = [], l[o] = [], n = a.elements[o][o], e = 0; e < h; e++)
              (s = a.elements[o][e] / n), i.push(s), e >= r && l[o].push(s);
            for (a.elements[o] = i, t = o; t--; ) {
              for (i = [], e = 0; e < h; e++)
                i.push(a.elements[t][e] - a.elements[o][e] * a.elements[t][o]);
              a.elements[t] = i;
            }
          }
          return d.create(l);
        },
        inv: function () {
          return this.inverse();
        },
        round: function () {
          return this.map(function (t) {
            return Math.round(t);
          });
        },
        snapTo: function (t) {
          return this.map(function (e) {
            return Math.abs(e - t) <= a.precision ? t : e;
          });
        },
        inspect: function () {
          for (var t = [], e = this.elements.length, i = 0; i < e; i++)
            t.push(r.Vector.create(this.elements[i]).inspect());
          return t.join("\n");
        },
        toArray: function () {
          for (var t = [], e = this.elements.length, i = 0; i < e; i++)
            t.push(this.elements[i]);
          return t;
        },
        setElements: function (t) {
          var e,
            i,
            n = t.elements || t;
          if (void 0 !== n[0][0]) {
            for (e = n.length, this.elements = []; e--; )
              for (i = n[e].length, this.elements[e] = []; i--; )
                this.elements[e][i] = n[e][i];
            return this;
          }
          var s = n.length;
          for (this.elements = [], e = 0; e < s; e++)
            this.elements.push([n[e]]);
          return this;
        },
        maxColumnIndexes: function () {
          for (var t = [], e = 1; e <= this.rows(); e++) {
            for (var i = null, n = -1, s = 1; s <= this.cols(); s++)
              (null === i || this.e(e, s) > i) && ((i = this.e(e, s)), (n = s));
            t.push(n);
          }
          return r.Vector.create(t);
        },
        maxColumns: function () {
          for (var t = [], e = 1; e <= this.rows(); e++) {
            for (var i = null, n = 1; n <= this.cols(); n++)
              (null === i || this.e(e, n) > i) && (i = this.e(e, n));
            t.push(i);
          }
          return r.Vector.create(t);
        },
        minColumnIndexes: function () {
          for (var t = [], e = 1; e <= this.rows(); e++) {
            for (var i = null, n = -1, s = 1; s <= this.cols(); s++)
              (null === i || this.e(e, s) < i) && ((i = this.e(e, s)), (n = s));
            t.push(n);
          }
          return r.Vector.create(t);
        },
        minColumns: function () {
          for (var t = [], e = 1; e <= this.rows(); e++) {
            for (var i = null, n = 1; n <= this.cols(); n++)
              (null === i || this.e(e, n) < i) && (i = this.e(e, n));
            t.push(i);
          }
          return r.Vector.create(t);
        },
        partialPivot: function (t, e, i, n, s) {
          for (var r = 0, o = 0, a = t; a <= n.rows(); a++)
            Math.abs(n.e(a, e)) > o && ((o = Math.abs(n.e(t, e))), (r = a));
          if (r != t) {
            var h = n.elements[t - 1];
            (n.elements[t - 1] = n.elements[r - 1]),
              (n.elements[r - 1] = h),
              (i.elements[t - 1][t - 1] = 0),
              (i.elements[t - 1][r - 1] = 1),
              (i.elements[r - 1][r - 1] = 0),
              (i.elements[r - 1][t - 1] = 1);
          }
          return i;
        },
        forwardSubstitute: function (t) {
          for (var e = [], i = 1; i <= this.rows(); i++) {
            for (var n = 0, s = 1; s < i; s++) n += this.e(i, s) * e[s - 1];
            e.push((t.e(i) - n) / this.e(i, i));
          }
          return r.Vector.create(e);
        },
        backSubstitute: function (t) {
          for (var e = [], i = this.rows(); i > 0; i--) {
            for (var n = 0, s = this.cols(); s > i; s--)
              n += this.e(i, s) * e[this.rows() - s];
            e.push((t.e(i) - n) / this.e(i, i));
          }
          return r.Vector.create(e.reverse());
        },
        luPack: v,
        luJs: p,
        svdJs: l,
        svdPack: c,
        qrJs: u,
        qrPack: f,
      }),
        (s = (function () {
          try {
            return n(
              !(function () {
                var t = new Error("Cannot find module 'lapack'");
                throw ((t.code = "MODULE_NOT_FOUND"), t);
              })(),
            );
          } catch (t) {}
        })())
          ? ((d.prototype.svd = c), (d.prototype.qr = f), (d.prototype.lu = v))
          : ((d.prototype.svd = l), (d.prototype.qr = u), (d.prototype.lu = p)),
        (d.create = function (t, e) {
          return new d().setElements(t);
        }),
        (d.I = function (t) {
          for (var e, i = [], n = t; n--; )
            for (e = t, i[n] = []; e--; ) i[n][e] = n == e ? 1 : 0;
          return d.create(i);
        }),
        (d.loadFile = function (t) {
          for (
            var e = [], i = o.readFileSync(t, "utf-8").split("\n"), n = 0;
            n < i.length;
            n++
          ) {
            var s = i[n].split(",");
            s.length > 1 && e.push(s);
          }
          return new d().setElements(e);
        }),
        (d.Diagonal = function (t) {
          for (var e = t.length, i = d.I(e); e--; ) i.elements[e][e] = t[e];
          return i;
        }),
        (d.Rotation = function (t, e) {
          if (!e)
            return d.create([
              [Math.cos(t), -Math.sin(t)],
              [Math.sin(t), Math.cos(t)],
            ]);
          var i = e.dup();
          if (3 != i.elements.length) return null;
          var n = i.modulus(),
            s = i.elements[0] / n,
            r = i.elements[1] / n,
            o = i.elements[2] / n,
            a = Math.sin(t),
            h = Math.cos(t),
            l = 1 - h;
          return d.create([
            [l * s * s + h, l * s * r - a * o, l * s * o + a * r],
            [l * s * r + a * o, l * r * r + h, l * r * o - a * s],
            [l * s * o - a * r, l * r * o + a * s, l * o * o + h],
          ]);
        }),
        (d.RotationX = function (t) {
          var e = Math.cos(t),
            i = Math.sin(t);
          return d.create([
            [1, 0, 0],
            [0, e, -i],
            [0, i, e],
          ]);
        }),
        (d.RotationY = function (t) {
          var e = Math.cos(t),
            i = Math.sin(t);
          return d.create([
            [e, 0, i],
            [0, 1, 0],
            [-i, 0, e],
          ]);
        }),
        (d.RotationZ = function (t) {
          var e = Math.cos(t),
            i = Math.sin(t);
          return d.create([
            [e, -i, 0],
            [i, e, 0],
            [0, 0, 1],
          ]);
        }),
        (d.Random = function (t, e) {
          return (
            1 === arguments.length && (e = t),
            d.Zero(t, e).map(function () {
              return Math.random();
            })
          );
        }),
        (d.Fill = function (t, e, i) {
          2 === arguments.length && ((i = e), (e = t));
          for (var n, s = [], r = t; r--; )
            for (n = e, s[r] = []; n--; ) s[r][n] = i;
          return d.create(s);
        }),
        (d.Zero = function (t, e) {
          return d.Fill(t, e, 0);
        }),
        (d.Zeros = function (t, e) {
          return d.Zero(t, e);
        }),
        (d.One = function (t, e) {
          return d.Fill(t, e, 1);
        }),
        (d.Ones = function (t, e) {
          return d.One(t, e);
        }),
        (e.Matrix = d);
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.KalmanObservation = e.KalmanModel = void 0);
      var n = i(10),
        s = (function () {
          function t(t, e, i, n, s, r, o, a) {
            (this.x_k = t),
              (this.P_k = e),
              (this.F_k = i),
              (this.u_k = n),
              (this.U_k = s),
              (this.B_k = r),
              (this.Q_k = o),
              (this.N_k = a);
          }
          return (
            (t.prototype.predict = function () {
              (this.I = n.Matrix.I(this.P_k.rows())),
                (this.x_k_ = this.x_k),
                (this.P_k_ = this.P_k),
                (this.x_k_k_ = this.F_k.x(this.x_k_).add(this.B_k.x(this.u_k))),
                (this.P_k_k_ = this.F_k.x(this.P_k_.x(this.F_k.transpose()))
                  .add(this.B_k.x(this.U_k.x(this.B_k.transpose())))
                  .add(this.N_k.x(this.Q_k).x(this.N_k.transpose())));
            }),
            (t.prototype.update = function (t) {
              (this.I = n.Matrix.I(this.P_k.rows())),
                (this.x_k_ = this.x_k),
                (this.P_k_ = this.P_k),
                (this.x_k_k_ = this.F_k.x(this.x_k_).add(this.B_k.x(this.u_k))),
                (this.P_k_k_ = this.F_k.x(this.P_k_.x(this.F_k.transpose()))
                  .add(this.B_k.x(this.U_k.x(this.B_k.transpose())))
                  .add(this.N_k.x(this.Q_k).x(this.N_k.transpose()))),
                (this.y_k = t.z_k.subtract(t.H_k.x(this.x_k_k_))),
                (this.S_k = t.H_k.x(this.P_k_k_.x(t.H_k.transpose())).add(
                  t.R_k,
                )),
                (this.K_k = this.P_k_k_.x(
                  t.H_k.transpose().x(this.S_k.inverse()),
                )),
                (this.x_k = this.x_k_k_.add(this.K_k.x(this.y_k).prop(t.R_k))),
                (this.P_k = this.I.subtract(this.K_k.x(t.H_k)).x(this.P_k_k_));
            }),
            t
          );
        })(),
        r = function (t, e, i) {
          (this.z_k = t), (this.H_k = e), (this.R_k = i);
        };
      (e.KalmanModel = s), (e.KalmanObservation = r);
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.KalmanFilterPDR = void 0);
      var n,
        s = function (t, e) {
          if (Array.isArray(t)) return t;
          if (Symbol.iterator in Object(t))
            return (function (t, e) {
              var i = [],
                n = !0,
                s = !1,
                r = void 0;
              try {
                for (
                  var o, a = t[Symbol.iterator]();
                  !(n = (o = a.next()).done) &&
                  (i.push(o.value), !e || i.length !== e);
                  n = !0
                );
              } catch (t) {
                (s = !0), (r = t);
              } finally {
                try {
                  !n && a.return && a.return();
                } finally {
                  if (s) throw r;
                }
              }
              return i;
            })(t, e);
          throw new TypeError(
            "Invalid attempt to destructure non-iterable instance",
          );
        },
        r = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        o = i(10),
        a = i(18),
        h = i(2),
        l = (n = i(5)) && n.__esModule ? n : { default: n };
      i(0);
      var c = (function () {
        function t(e, i, n) {
          !(function (t, e) {
            if (!(t instanceof e))
              throw new TypeError("Cannot call a class as a function");
          })(this, t),
            (this.t = e),
            (this.deviceType = n),
            (this.kfType = i),
            (this.AoADistTh1 = 2),
            (this.AoADistTh2 = 3),
            (this.penaltyL1 = 5),
            (this.penaltyL2 = 10),
            (this.resetCntTh1 = 8),
            (this.resetCntTh2 = 3),
            (this.reset2AoACntTh = 5),
            this.initKfTypeParams(),
            this.setTypeParameters(this.kfType),
            this.reset();
        }
        return (
          r(t, [
            {
              key: "initKfTypeParams",
              value: function () {
                this.kfTypeParams = {
                  0: {
                    btObrVar: 36,
                    geoObrVar: 36,
                    aoaObrVar: 1,
                    processStd: 0.5,
                    distThresholdL1: 10,
                    distThresholdL2: 20,
                    distThresholdFar: 20,
                  },
                  1: {
                    btObrVar: 36,
                    geoObrVar: 36,
                    aoaObrVar: 1,
                    processStd: 0.2,
                    distThresholdL1: 10,
                    distThresholdL2: 20,
                    distThresholdFar: 20,
                  },
                  2: {
                    btObrVar: 900,
                    geoObrVar: 900,
                    aoaObrVar: 1,
                    processStd: 0.08,
                    distThresholdL1: 10,
                    distThresholdL2: 20,
                    distThresholdFar: 20,
                  },
                  3: {
                    btObrVar: 900,
                    geoObrVar: 900,
                    aoaObrVar: 9,
                    processStd: 0.5,
                    distThresholdL1: 10,
                    distThresholdL2: 20,
                    distThresholdFar: 20,
                  },
                  4: {
                    btObrVar: 400,
                    geoObrVar: 400,
                    aoaObrVar: 9,
                    processStd: 2,
                    distThresholdL1: 15,
                    distThresholdL2: 20,
                    distThresholdFar: 20,
                  },
                  5: {
                    btObrVar: 1600,
                    geoObrVar: 400,
                    aoaObrVar: 9,
                    processStd: 2,
                    distThresholdL1: 30,
                    distThresholdL2: 50,
                    distThresholdFar: 50,
                  },
                  6: {
                    btObrVar: 6400,
                    geoObrVar: 400,
                    aoaObrVar: 100,
                    processStd: 2,
                    distThresholdL1: 30,
                    distThresholdL2: 50,
                    distThresholdFar: 50,
                  },
                  7: {
                    btObrVar: 121,
                    geoObrVar: 121,
                    aoaObrVar: 2,
                    processStd: 0.5,
                    distThresholdL1: 15,
                    distThresholdL2: 20,
                    distThresholdFar: 30,
                  },
                };
              },
            },
            {
              key: "reset",
              value: function () {
                (this.kalmanModel = null),
                  (this.observerModel = null),
                  (this.cnt = 0),
                  (this.penaltyBt = 1),
                  (this.penaltyGeo = 1),
                  (this.penaltyAoA = 1),
                  (this.notNearObrSignalCnt = 0),
                  (this.geoResetCnt = 0),
                  (this.aoaResetCnt = 0),
                  (this.unReliableBtCnt = 0),
                  (this.lastBtPosTime = null),
                  (this.lastGeoPosTime = null),
                  (this.lastAoaPosTime = null),
                  (this.lastPos = null),
                  (this.moveDist = -1),
                  (this.stepList = []);
              },
            },
            {
              key: "setTypeParameters",
              value: function (t) {
                (this.btObrVar = 36),
                  (this.geoObrVar = 36),
                  (this.aoaObrvar = 1),
                  (this.prsStd = 0.5),
                  (this.distThL1 = 10),
                  (this.distThL2 = 20),
                  (this.distThLFar = 20);
                var e = this.kfTypeParams[t];
                e &&
                  ("btObrVar" in e && (this.btObrVar = e.btObrVar),
                  "geoObrVar" in e && (this.geoObrVar = e.geoObrVar),
                  "aoaObrVar" in e && (this.aoaObrvar = e.aoaObrVar),
                  "processStd" in e && (this.prsStd = e.processStd),
                  "distThresholdL1" in e && (this.distThL1 = e.distThresholdL1),
                  "distThresholdL2" in e && (this.distThL2 = e.distThresholdL2),
                  "distThresholdFar" in e &&
                    (this.distThLFar = e.distThresholdFar));
              },
            },
            {
              key: "startKF",
              value: function (t, e, i) {
                if (t || e || i) {
                  t && (this.lastBtPosTime = t.t),
                    e && (this.lastGeoPosTime = e.t),
                    i && (this.lastAoaPosTime = i.t);
                  var n = this.calInitPosition(t, e, i),
                    r = this.initKFModel(
                      n,
                      this.prsStd,
                      this.btObrVar,
                      this.geoObrVar,
                      this.aoaObrvar,
                    ),
                    o = s(r, 2);
                  (this.kalmanModel = o[0]),
                    (this.observerModel = o[1]),
                    (this.cnt =
                      this.notNearObrSignalCnt =
                      this.geoResetCnt =
                      this.unReliableBtCnt =
                        0);
                }
              },
            },
            {
              key: "calInitPosition",
              value: function (t, e, i) {
                var n = t && t.c ? 1 / t.c : 0,
                  s = e && e.c ? 1 / e.c : 0,
                  r = i && i.c ? 1 / i.c : 0,
                  o = Math.sqrt(this.btObrVar / this.geoObrVar),
                  a = Math.sqrt(this.btObrVar / this.aoaObrvar),
                  h = 1 * n + s * o + r * a,
                  l = 0,
                  c = 0;
                return (
                  t && ((l += 1 * n * t.x), (c += 1 * n * t.y)),
                  i && ((l += r * a * i.x), (c += r * a * i.y)),
                  e && ((l += s * o * e.x), (c += s * o * e.y)),
                  0 === h ? this.lastPos : { x: l / h, y: c / h }
                );
              },
            },
            {
              key: "initKFModel",
              value: function (t, e, i, n, s) {
                var r = o.Vector.create([t.x, t.y]),
                  h = o.Matrix.Diagonal([900, 900]),
                  l = o.Matrix.create([
                    [1, 0],
                    [0, 1],
                  ]),
                  c = o.Vector.create([0, 0]),
                  u = o.Matrix.Diagonal([0, 0]),
                  f = o.Matrix.create([
                    [1, 0],
                    [0, 1],
                  ]),
                  d = o.Matrix.Diagonal([e * e, e * e]),
                  v = o.Matrix.create([
                    [1, 0],
                    [0, 1],
                  ]),
                  p = new a.KalmanModel(r, h, l, c, u, f, d, v),
                  y = o.Vector.create([t.x, t.y, t.x, t.y, t.x, t.y]),
                  m = o.Matrix.create([
                    [1, 0],
                    [0, 1],
                    [1, 0],
                    [0, 1],
                    [1, 0],
                    [0, 1],
                  ]),
                  g = o.Matrix.Diagonal([i, i, n, n, s, s]);
                return [p, new a.KalmanObservation(y, m, g)];
              },
            },
            {
              key: "calPdrDisplacement",
              value: function (t, e, i) {
                return t || 0 === t
                  ? o.Vector.create([e * i * Math.sin(t), e * i * Math.cos(t)])
                  : o.Vector.create([0, 0]);
              },
            },
            {
              key: "calPenalty",
              value: function (t, e, i) {
                var n = h.LocationUtils.distance(t, e),
                  s = i ? this.distThL1 : this.distThL2,
                  r = this.distThLFar;
                return n < s ? 1 : n < r ? this.penaltyL1 : this.penaltyL2;
              },
            },
            {
              key: "calPenaltyAoA",
              value: function (t, e) {
                var i = h.LocationUtils.distance(t, e);
                return i < this.AoADistTh1
                  ? 1
                  : i < this.AoADistTh2
                    ? this.penaltyL1
                    : this.penaltyL2;
              },
            },
            {
              key: "checkReset",
              value: function (t, e, i, n, s, r, o) {
                (this.penaltyBt = this.calPenalty(t, this.lastPos, n)),
                  (this.penaltyGeo = this.calPenalty(e, this.lastPos, n)),
                  (this.penaltyAoA = this.calPenaltyAoA(i, this.lastPos)),
                  e && e.c < 2.5 && this.penaltyGeo >= 5
                    ? ((t && t.c < 3) || (this.unReliableBtCnt += 1),
                      (this.geoResetCnt += 1))
                    : (this.geoResetCnt = this.unReliableBtCnt = 0);
                var a =
                  this.geoResetCnt >= this.resetCntTh2 &&
                  this.unReliableBtCnt > 0 &&
                  e &&
                  e.c < 3;
                i && i.c <= 3 && this.penaltyAoA >= 10
                  ? (this.aoaResetCnt += 1)
                  : (this.aoaResetCnt = 0),
                  (this.reset2AoACntTh = o ? 5 : 10);
                var l = this.aoaResetCnt >= this.reset2AoACntTh;
                (t && this.penaltyBt > 0 && this.penaltyBt < 5) ||
                (e && this.penaltyGeo > 0 && this.penaltyGeo < 5) ||
                (i && this.penaltyAoA > 0 && this.penaltyAoA < 5)
                  ? (this.notNearObrSignalCnt = 0)
                  : ((t && t.c < 3) ||
                      (h.LocationUtils.distance(t, this.lastPos) > 12 && !o) ||
                      (e && e.c < 3) ||
                      (i && i.c < 2)) &&
                    ((this.notNearObrSignalCnt += 1),
                    s &&
                      (this.stepList.push({ t: this.t }),
                      this.t - this.stepList[0].t > 3e3 &&
                        this.stepList.shift())),
                  (this.resetCntTh1 = this.stepList.length < 3 ? 4 : 8);
                var c = this.notNearObrSignalCnt >= 10 && !o,
                  u = (t && t.c < 4) || (e && e.c < 3) || (i && i.c < 2);
                (!r || r < 3) && ((c && u) || a || l) && this.startKF(t, e, i);
              },
            },
            {
              key: "updateKfModel",
              value: function (t, e, i, n) {
                !n && t && (t.c = 1),
                  t || (t = { x: 0, y: 0, c: 0, t: 0 }),
                  e || (e = { x: 0, y: 0, c: 0, t: 0 }),
                  i || (i = { x: 0, y: 0, c: 0, t: 0 }),
                  (this.observerModel.z_k = o.Vector.create([
                    t.x,
                    t.y,
                    e.x,
                    e.y,
                    i.x,
                    i.y,
                  ])),
                  (this.observerModel.R_k = this.calObserveCov(
                    this.btObrVar,
                    t.c,
                    this.penaltyBt,
                    this.geoObrVar,
                    e.c,
                    this.penaltyGeo,
                    this.aoaObrvar,
                    i.c,
                    this.penaltyAoA,
                  )),
                  this.kalmanModel.update(this.observerModel),
                  (this.moveDist = h.LocationUtils.distance(
                    this.getPosition(),
                    this.lastPos,
                  )),
                  (this.lastPos = this.getPosition());
              },
            },
            {
              key: "getObrMeasurements",
              value: function (t, e, i) {
                var n = (0, l.default)(t),
                  s = (0, l.default)(e),
                  r = (0, l.default)(i);
                return (
                  n &&
                    (n.t < this.t - 1e3 || n.t === this.lastBtPosTime
                      ? (n = null)
                      : (this.lastBtPosTime = n.t)),
                  s &&
                    (s.t < this.t - 1500 || s.t === this.lastGeoPosTime
                      ? (s = null)
                      : (this.lastGeoPosTime = s.t)),
                  r &&
                    (r.t < this.t - 800 || r.t === this.lastAoaPosTime
                      ? (r = null)
                      : (this.lastAoaPosTime = r.t)),
                  [n, s, r]
                );
              },
            },
            {
              key: "update",
              value: function (t, e, i, n, r, o, a, h, l, c, u) {
                if (
                  ((this.t = t),
                  this.kalmanModel || this.startKF(e, i, n),
                  this.kalmanModel)
                ) {
                  this.cnt++;
                  var f = this.getObrMeasurements(e, i, n),
                    d = s(f, 3),
                    v = d[0],
                    p = d[1],
                    y = d[2];
                  this.adjustAoa_c(y),
                    this.checkReset(v, p, y, l, a, c, u),
                    (this.kalmanModel.u_k = this.calPdrDisplacement(r, o, a)),
                    this.updateKfModel(v, p, y, h);
                }
              },
            },
            {
              key: "setState",
              value: function (t) {
                t &&
                  "x" in t &&
                  this.kalmanModel &&
                  (this.kalmanModel.x_k = o.Vector.create([t.x, t.y]));
              },
            },
            {
              key: "setBtObrVar",
              value: function (t) {
                (this.btObrVar = t), (this.geoObrVar = t);
              },
            },
            {
              key: "setProcessCov",
              value: function (t) {
                (this.prsStd = t),
                  (this.kalmanModel.Q_k = o.Matrix.Diagonal([t * t, t * t]));
              },
            },
            {
              key: "calObserveCov",
              value: function (t, e, i, n, s, r, a, h, l) {
                return (
                  (t =
                    0 === e || 0 === i
                      ? Number.POSITIVE_INFINITY
                      : e < 1
                        ? e
                        : t * Math.pow(e * i, 2)),
                  (n =
                    0 === s || 0 === r
                      ? Number.POSITIVE_INFINITY
                      : s < 1
                        ? s
                        : n * Math.pow(s * r, 2)),
                  (a =
                    0 === h || 0 === l
                      ? Number.POSITIVE_INFINITY
                      : h < 1
                        ? h
                        : a * Math.pow(h * l, 2)),
                  o.Matrix.Diagonal([t, t, n, n, a, a])
                );
              },
            },
            {
              key: "getPosition",
              value: function () {
                if (this.kalmanModel)
                  return {
                    x: this.kalmanModel.x_k.elements[0],
                    y: this.kalmanModel.x_k.elements[1],
                  };
              },
            },
            {
              key: "getDspInfo",
              value: function () {
                var t = "type:" + this.kfType;
                return (
                  this.kalmanModel &&
                    (t +=
                      " x:" +
                      this.kalmanModel.x_k.elements[0].toFixed(1) +
                      " y:" +
                      this.kalmanModel.x_k.elements[1].toFixed(1)),
                  t
                );
              },
            },
            {
              key: "getMoveDist",
              value: function () {
                return this.moveDist;
              },
            },
            {
              key: "adjustAoa_c",
              value: function (t) {
                var e = 1e5,
                  i = !0,
                  n = !1,
                  s = void 0;
                try {
                  for (
                    var r,
                      o = [
                        { x: 11601376.094, y: 3633240.95, z: 0 },
                        { x: 11601248.506, y: 3633222.453, z: 0 },
                        { x: 11601376.688, y: 3633240.356, z: 3 },
                        { x: 11601297.045, y: 3633229.968, z: 3 },
                      ][Symbol.iterator]();
                    !(i = (r = o.next()).done);
                    i = !0
                  ) {
                    var a = r.value;
                    if (t && a.z === t.z) {
                      var l = h.LocationUtils.distance(t, a);
                      l < e && (e = l);
                    }
                  }
                } catch (t) {
                  (n = !0), (s = t);
                } finally {
                  try {
                    !i && o.return && o.return();
                  } finally {
                    if (n) throw s;
                  }
                }
                e < 6.5 && (t.c += 2);
              },
            },
          ]),
          t
        );
      })();
      e.KalmanFilterPDR = c;
    },
    function (t, e, i) {
      t.exports = i(36);
    },
    function (t, e, i) {
      t.exports = function (t, e) {
        return function () {
          for (var i = new Array(arguments.length), n = 0; n < i.length; n++)
            i[n] = arguments[n];
          return t.apply(e, i);
        };
      };
    },
    function (t, e, i) {
      var n = i(1),
        s = i(41),
        r = i(43),
        o = i(44),
        a = i(45),
        h = i(23);
      t.exports = function (t) {
        return new Promise(function (e, l) {
          var c = t.data,
            u = t.headers;
          n.isFormData(c) && delete u["Content-Type"];
          var f = new XMLHttpRequest();
          if (t.auth) {
            var d = t.auth.username || "",
              v = t.auth.password || "";
            u.Authorization = "Basic " + btoa(d + ":" + v);
          }
          if (
            (f.open(
              t.method.toUpperCase(),
              r(t.url, t.params, t.paramsSerializer),
              !0,
            ),
            (f.timeout = t.timeout),
            (f.onreadystatechange = function () {
              if (
                f &&
                4 === f.readyState &&
                (0 !== f.status ||
                  (f.responseURL && 0 === f.responseURL.indexOf("file:")))
              ) {
                var i =
                    "getAllResponseHeaders" in f
                      ? o(f.getAllResponseHeaders())
                      : null,
                  n = {
                    data:
                      t.responseType && "text" !== t.responseType
                        ? f.response
                        : f.responseText,
                    status: f.status,
                    statusText: f.statusText,
                    headers: i,
                    config: t,
                    request: f,
                  };
                s(e, l, n), (f = null);
              }
            }),
            (f.onerror = function () {
              l(h("Network Error", t, null, f)), (f = null);
            }),
            (f.ontimeout = function () {
              l(
                h(
                  "timeout of " + t.timeout + "ms exceeded",
                  t,
                  "ECONNABORTED",
                  f,
                ),
              ),
                (f = null);
            }),
            n.isStandardBrowserEnv())
          ) {
            var p = i(46),
              y =
                (t.withCredentials || a(t.url)) && t.xsrfCookieName
                  ? p.read(t.xsrfCookieName)
                  : void 0;
            y && (u[t.xsrfHeaderName] = y);
          }
          if (
            ("setRequestHeader" in f &&
              n.forEach(u, function (t, e) {
                void 0 === c && "content-type" === e.toLowerCase()
                  ? delete u[e]
                  : f.setRequestHeader(e, t);
              }),
            t.withCredentials && (f.withCredentials = !0),
            t.responseType)
          )
            try {
              f.responseType = t.responseType;
            } catch (e) {
              if ("json" !== t.responseType) throw e;
            }
          "function" == typeof t.onDownloadProgress &&
            f.addEventListener("progress", t.onDownloadProgress),
            "function" == typeof t.onUploadProgress &&
              f.upload &&
              f.upload.addEventListener("progress", t.onUploadProgress),
            t.cancelToken &&
              t.cancelToken.promise.then(function (t) {
                f && (f.abort(), l(t), (f = null));
              }),
            void 0 === c && (c = null),
            f.send(c);
        });
      };
    },
    function (t, e, i) {
      var n = i(42);
      t.exports = function (t, e, i, s, r) {
        var o = new Error(t);
        return n(o, e, i, s, r);
      };
    },
    function (t, e, i) {
      t.exports = function (t) {
        return !(!t || !t.__CANCEL__);
      };
    },
    function (t, e, i) {
      function n(t) {
        this.message = t;
      }
      (n.prototype.toString = function () {
        return "Cancel" + (this.message ? ": " + this.message : "");
      }),
        (n.prototype.__CANCEL__ = !0),
        (t.exports = n);
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.BluetoothLocator = void 0);
      var n = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        s = i(2),
        r = i(0),
        o = i(13);
      function a(t, e) {
        if (!(t instanceof e))
          throw new TypeError("Cannot call a class as a function");
      }
      i(3), i(7);
      var h = (function () {
          function t() {
            a(this, t);
          }
          return (
            n(t, null, [
              {
                key: "calBtPos",
                value: function (e, i, n, s, r) {
                  if (0 === e.length) return null;
                  e.sort(function (t, e) {
                    return e.rssi - t.rssi;
                  });
                  var o = e[0].rssi,
                    a = e.slice(0, 5);
                  t.calGradientWeight(a, o);
                  var h = a.reduce(function (t, e) {
                      return t + e.weight;
                    }, 0),
                    l = t.calConfidence(a),
                    c =
                      a.reduce(function (t, e) {
                        return t + e.rssi;
                      }, 0) / a.length;
                  return {
                    x:
                      a.reduce(function (t, e) {
                        return t + e.x * e.weight;
                      }, 0) / h,
                    y:
                      a.reduce(function (t, e) {
                        return t + e.y * e.weight;
                      }, 0) / h,
                    z: parseFloat(i),
                    c: l,
                    p: 0,
                    s: !1,
                    m: c,
                  };
                },
              },
              {
                key: "getMostProbZ",
                value: function (e) {
                  if (!e || e.length < 1)
                    return { zWeights: {}, maxZ: -1e4, maxZWeight: 0 };
                  e.sort(function (t, e) {
                    return e.rssi - t.rssi;
                  });
                  var i = e.slice(0, 10),
                    n = i[0].rssi,
                    s = {},
                    r = 0;
                  i.forEach(function (e) {
                    var i = t.weight(n, e.rssi);
                    (r += i), e.z in s ? (s[e.z] += i) : (s[e.z] = i);
                  });
                  var o = 0,
                    a = "-10000";
                  for (var h in s) {
                    var l = parseFloat(s[h]) / r;
                    (s[h] = l), l > o && ((a = h), (o = l));
                  }
                  return { zWeights: s, maxZ: parseFloat(a), maxZWeight: o };
                },
              },
              {
                key: "adjustSpecialBeacons",
                value: function (t) {
                  void 0 !== t.cf &&
                    Object.keys(t.cf).forEach(function (e) {
                      "strength" === e &&
                        (t.rssi >= -90 && t.rssi < -85
                          ? (t.rssi += 3 * t.cf[e])
                          : t.rssi >= -85 && t.rssi < -70
                            ? (t.rssi += 4 * t.cf[e])
                            : t.rssi >= -70 &&
                              t.rssi < -60 &&
                              (t.rssi += 3 * t.cf[e]));
                    });
                },
              },
              {
                key: "weight",
                value: function (t, e) {
                  return (
                    3 /
                    (3 +
                      (3083.5 / (1 + (-3.5 + t) * (-3.5 + t))) *
                        Math.abs(t - e))
                  );
                },
              },
              {
                key: "divergence",
                value: function (t) {
                  for (var e = 0, i = 0, n = 0; n < t.length - 1; n++)
                    for (var s = n + 1; s < t.length; s++)
                      (e += 1),
                        (i += Math.sqrt(
                          Math.pow(t[n].x - t[s].x, 2) +
                            Math.pow(t[n].y - t[s].y, 2),
                        ));
                  return e > 0 ? i / e : 0;
                },
              },
              {
                key: "calGradientWeight",
                value: function (t, e) {
                  t.map(function (t) {
                    var i,
                      n = e - t.rssi;
                    (i = n < 3 ? 1 : n <= 8 ? 0.66 : 0), (t.weight = i);
                  });
                },
              },
              {
                key: "calConfidence",
                value: function (e) {
                  var i = 1,
                    n =
                      e.reduce(function (t, e) {
                        return t + e.rssi;
                      }, 0) / e.length;
                  n < -78 && (i = 3 + (-78 - n) / 4);
                  var s = t.divergence(e),
                    r = 1;
                  return s > 14 && (r = 3 + (s - 14) / 5), i > r ? i : r;
                },
              },
            ]),
            t
          );
        })(),
        l = (function () {
          function t(e) {
            a(this, t),
              (this._aps = []),
              (this.apBoundary = null),
              e || (e = {}),
              (this.startTime = e.startTime || new Date().getTime()),
              (this.deviceType =
                void 0 !== e.deviceType
                  ? e.deviceType
                  : r.CONSTANTS.DEVICE.MONITOR),
              (this.firstBeaconsTime = null),
              (this.maxZList = []),
              this.setParams(e),
              (this.ap = 1),
              this.reset();
          }
          return (
            n(t, [
              {
                key: "setParams",
                value: function (t) {
                  t || (t = {}),
                    (this.REC_INTERVAL = t.RecInterval ? t.RecInterval : 5e3),
                    (this.QUERY_INTERVAL = t.QueryInterval
                      ? t.QueryInterval
                      : 2e3),
                    (this.Z_CHECK_INTERVAL = t.ZCheckInterval
                      ? t.ZCheckInterval
                      : 3e3),
                    (this.ZInitTimeout = t.ZInitTimeout ? t.ZInitTimeout : 3e3),
                    (this.apBoundary = t.default
                      ? t.default.apBoundary
                      : this.apBoundary);
                },
              },
              {
                key: "reset",
                value: function () {
                  (this.cnt = 0),
                    (this.curZCnt = 0),
                    (this.z = void 0),
                    (this.startFlag = 0),
                    (this.btPosList = []),
                    (this.cMean = void 0),
                    (this.listTimeLen = 5e3);
                },
              },
              {
                key: "addAps",
                value: function (t) {
                  if (t) {
                    var e = !0,
                      i = !1,
                      n = void 0;
                    try {
                      for (
                        var s, r = t[Symbol.iterator]();
                        !(e = (s = r.next()).done);
                        e = !0
                      ) {
                        var o = s.value;
                        void 0 === o.z && (o.z = o.re), (o.rssiList = []);
                      }
                    } catch (t) {
                      (i = !0), (n = t);
                    } finally {
                      try {
                        !e && r.return && r.return();
                      } finally {
                        if (i) throw n;
                      }
                    }
                    this._aps = this._aps.concat(t);
                  }
                },
              },
              {
                key: "resetAps",
                value: function () {
                  this._aps &&
                    this._aps.forEach(function (t) {
                      t.rssiList = [];
                    });
                },
              },
              {
                key: "matchAp",
                value: function (t, e) {
                  if (!this._aps) return null;
                  for (var i = 0; i < this._aps.length; i++) {
                    var n = this._aps[i];
                    if (
                      parseInt(n.ma) === parseInt(t) &&
                      parseInt(n.mi) === parseInt(e)
                    )
                      return n;
                  }
                  return null;
                },
              },
              {
                key: "getCurrentBeacons",
                value: function (t, e) {
                  var i = [],
                    n = 0,
                    s = !0,
                    r = !1,
                    o = void 0;
                  try {
                    for (
                      var a, h = this._aps[Symbol.iterator]();
                      !(s = (a = h.next()).done);
                      s = !0
                    ) {
                      var l = a.value;
                      if (l.rssiList.length > 0) {
                        var c = !0,
                          u = !1,
                          f = void 0;
                        try {
                          for (
                            var d, v = l.rssiList[Symbol.iterator]();
                            !(c = (d = v.next()).done);
                            c = !0
                          ) {
                            var p = d.value;
                            e - p.timestamp > n && (n = e - p.timestamp),
                              e - p.timestamp < t &&
                                i.push({
                                  major: l.ma,
                                  minor: l.mi,
                                  x: l.x,
                                  y: l.y,
                                  buildingCode: l.buildingCode,
                                  region: l.re,
                                  timestamp: p.timestamp,
                                  rssi: p.rssi,
                                  z: l.z,
                                  cf: l.cf,
                                });
                          }
                        } catch (t) {
                          (u = !0), (f = t);
                        } finally {
                          try {
                            !c && v.return && v.return();
                          } finally {
                            if (u) throw f;
                          }
                        }
                      }
                    }
                  } catch (t) {
                    (r = !0), (o = t);
                  } finally {
                    try {
                      !s && h.return && h.return();
                    } finally {
                      if (r) throw o;
                    }
                  }
                  return (
                    i.sort(function (t, e) {
                      return e.rssi !== t.rssi
                        ? e.rssi - t.rssi
                        : e.timestamp - t.timestamp;
                    }),
                    i
                  );
                },
              },
              {
                key: "updateBtPosList",
                value: function (t, e) {
                  for (
                    e.t = t, e.dist2Navi = 0, this.btPosList.push(e);
                    this.btPosList.length > 0 &&
                    e.t - this.btPosList[0].t > this.listTimeLen;

                  )
                    this.btPosList.shift();
                  this.cMean = e.cMean = this.getMeanBtConfidence();
                },
              },
              {
                key: "getMeanBtConfidence",
                value: function () {
                  var t = (this.btPosList.length / this.listTimeLen) * 1e3,
                    e =
                      this.btPosList.length > 0
                        ? this.btPosList.reduce(function (t, e) {
                            return t + e.c;
                          }, 0) / this.btPosList.length
                        : 1;
                  return t < 0.8 && (e += (1 - t) / 0.5), e;
                },
              },
              {
                key: "updateApsByReceivedBeacons",
                value: function (t, e) {
                  var i = this,
                    n = !1;
                  e.forEach(function (e) {
                    var s = i.matchAp(e.major, e.minor);
                    if (
                      s &&
                      "-100" !== e.rssi &&
                      "0" !== e.rssi &&
                      0 !== e.rssi &&
                      -100 !== e.rssi
                    ) {
                      var r = s.rssiList.push({
                        timestamp: t,
                        rssi: parseInt(e.rssi),
                      });
                      (s.status = 1), (n = !0), r > 15 && s.rssiList.shift();
                    }
                  }),
                    0 === this.cnt &&
                      n &&
                      !this.firstBeaconsTime &&
                      ((this.firstBeaconsTime = t),
                      console.log("first valid beacon received", t));
                },
              },
              {
                key: "checkInitZ",
                value: function (t) {
                  if (
                    this.maxZList.length < 5 &&
                    (this.maxZList.push(t.maxZ), this.maxZList.length > 4)
                  ) {
                    var e = {},
                      i = [];
                    this.maxZList.forEach(function (t) {
                      e[t] || (e[t] = []), e[t].push(t);
                    });
                    var n = 0,
                      s = void 0;
                    for (var r in e)
                      (i = e[r]).length > n && ((n = i.length), (s = r));
                    n >= 3 &&
                      this.maxZList[3] === parseFloat(s) &&
                      this.maxZList[4] === parseFloat(s) &&
                      (t.maxZWeight = 1.1);
                  }
                },
              },
              {
                key: "locate",
                value: function (t, e) {
                  if (!t || void 0 === e) return null;
                  var i = t.filter(function (t) {
                      return t.z === e;
                    }),
                    n = h.calBtPos(i),
                    r = t.filter(function (t) {
                      return (
                        t.z === e ||
                        t.z <= o.HEIGHT.STAIRS ||
                        s.LocationUtils.distance(t, n) < 12
                      );
                    });
                  return h.calBtPos(r, e, this.apBoundary);
                },
              },
              {
                key: "calPos",
                value: function (t, e, i, n, o, a, l, c) {
                  var u = this;
                  if (!e || e.length < 1) return null;
                  var f = (e = e.filter(function (t) {
                      return (
                        h.adjustSpecialBeacons(t),
                        !o || s.LocationUtils.distance(o, t) <= 100
                      );
                    })).filter(function (e) {
                      return t - e.timestamp < (a ? 5e3 * l : u.QUERY_INTERVAL);
                    }),
                    d = e.filter(function (e) {
                      return t - e.timestamp < u.Z_CHECK_INTERVAL;
                    });
                  if (0 === d.length || 0 === f.length) return null;
                  var v = h.getMostProbZ(d);
                  for (var p in ((v.t = t), v.zWeights))
                    v[p] = this.locate(f, parseFloat(p));
                  if (
                    (this.updateBtPosList(t, v[v.maxZ]),
                    this.checkInitZ(v),
                    this.z === v.maxZ)
                  ) {
                    var y = c ? 0.9 : 0.7,
                      m = c ? 16 : 10;
                    v.maxZWeight > y && v[v.maxZ].c < 3
                      ? (this.curZCnt += 1)
                      : (this.curZCnt = 0),
                      ((!n && this.curZCnt > 8 && this.cMean < 3) ||
                        (n && this.curZCnt > m && this.cMean < 1.5) ||
                        this.curZCnt > m) &&
                        (v.maxZWeight = 1.1),
                      v.maxZWeight > 1 && (this.curZCnt = 12);
                  } else (this.curZCnt = 0), (this.z = v.maxZ);
                  return (
                    this.startFlag ||
                      ((this.deviceType === r.CONSTANTS.DEVICE.MONITOR ||
                        (t - this.firstBeaconsTime >= 1500 &&
                          this.cMean <= 3) ||
                        t - this.firstBeaconsTime > 3e3) &&
                        (this.startFlag = !0)),
                    this.startFlag ? ((this.cnt += 1), v) : void 0
                  );
                },
              },
            ]),
            t
          );
        })();
      e.BluetoothLocator = l;
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.AoaLocator = void 0);
      var n = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        s = i(2),
        r = i(4),
        o = i(0),
        a = (function () {
          function t(e) {
            !(function (t, e) {
              if (!(t instanceof e))
                throw new TypeError("Cannot call a class as a function");
            })(this, t),
              e || (e = {}),
              (this.deviceType =
                void 0 !== e.deviceType
                  ? e.deviceType
                  : o.CONSTANTS.DEVICE.MONITOR),
              (this.aoaAreas = []),
              (this.mapId2HeightMap = null),
              this.setParams(e),
              this.reset();
          }
          return (
            n(t, [
              {
                key: "setParams",
                value: function (t) {
                  t || (t = {}),
                    (this.aoaAreas = t.aoaAreas ? t.aoaAreas : []),
                    (this.mapId2HeightMap = t.default
                      ? t.default.mapId2HeightMap
                      : this.mapId2HeightMap);
                },
              },
              {
                key: "reset",
                value: function () {
                  (this.position = null),
                    (this.infoList = []),
                    (this.infoTimeLen = 2500),
                    (this.posList = []),
                    (this.meanRssi = 0),
                    (this.distSum = 0),
                    (this.rssiSum = 0),
                    (this.freq = 0);
                },
              },
              {
                key: "saveInfoList",
                value: function (t) {
                  var e = {
                    timestamp: t.timestamp,
                    x: t.x,
                    y: t.y,
                    rssi: t.rssi,
                    dist: 0,
                    headingChange: 0,
                  };
                  for (
                    this.infoList.push(e),
                      this.position &&
                        t.timestamp !== this.position.timestamp &&
                        ((e.dist = s.LocationUtils.distance(t, this.position)),
                        (e.heading =
                          r.Numerical.RAD2DEG *
                          Math.atan2(
                            t.x - this.position.x,
                            t.y - this.position.y,
                          )),
                        (this.distSum += e.dist),
                        (this.rssiSum += e.rssi),
                        this.infoList.length > 0 &&
                          (e.headingChange = Math.abs(
                            s.LocationUtils.angleDiff(
                              e.heading,
                              this.infoList[this.infoList.length - 1].heading,
                            ),
                          )));
                    this.infoList.length > 0 &&
                    t.timestamp - this.infoList[0].timestamp > this.infoTimeLen;

                  )
                    (this.distSum = this.distSum - this.infoList[0].dist),
                      (this.rssiSum = this.rssiSum - this.infoList[0].rssi),
                      this.infoList.shift();
                  this.freq = (this.infoList.length / this.infoTimeLen) * 1e3;
                },
              },
              {
                key: "getTranslationParam",
                value: function (t) {
                  this.transParam = t;
                },
              },
              {
                key: "updateAoAPos",
                value: function (t, e, i, n) {
                  if (
                    t &&
                    void 0 !== t.x &&
                    null !== t.x &&
                    void 0 !== t.y &&
                    null !== t.y
                  ) {
                    (t.timestamp = t.timestamp || new Date().getTime()),
                      this.saveInfoList(t);
                    var r = 0.7,
                      o = this.freq > 4 ? t : e,
                      a =
                        void 0 === n
                          ? this.aoaAreas.length > 0 &&
                            s.LocationUtils.checkInRegion(this.aoaAreas, o, i)
                          : n,
                      h = this.freq < 3;
                    return (
                      a ? h && (r = 3) : (r = h ? 8 : 5),
                      (t.c = r),
                      (t.z = this.mapId2HeightMap
                        ? this.mapId2HeightMap[t.mapId]
                        : t.z),
                      (this.position = t),
                      t
                    );
                  }
                },
              },
              {
                key: "updatePosition",
                value: function (t, e, i) {
                  if (
                    t &&
                    void 0 !== t.x &&
                    null !== t.x &&
                    void 0 !== t.y &&
                    null !== t.y &&
                    (this.posList.push(t), 3 === this.posList.length)
                  ) {
                    var n = s.LocationUtils.distance(
                        this.posList[0],
                        this.posList[1],
                      ),
                      r = s.LocationUtils.distance(
                        this.posList[1],
                        this.posList[2],
                      );
                    return (
                      n > 0 && n < 0.3 && r > 0 && r < 0.3
                        ? ((t.c =
                            this.calReliability(t) *
                            !s.LocationUtils.checkInRegion(this.aoaAreas, e, i)
                              ? 8
                              : 0.03),
                          void 0 !== this.infoList &&
                            (this.infoList.push(t),
                            this.infoList.length >= 3 &&
                              ((this.meanRssi =
                                this.infoList.reduce(function (t, e) {
                                  return t + e.rssi;
                                }, 0) / this.infoList.length),
                              (this.infoList = void 0))))
                        : (t.c =
                            0 === this.meanRssi
                              ? 7
                              : 4 * this.calReliability(t)),
                      this.transPosition(t),
                      (this.posList = []),
                      t
                    );
                  }
                },
              },
              {
                key: "calReliability",
                value: function (t) {
                  var e = 1;
                  if (0 !== this.meanRssi && t.rssi < this.meanRssi) {
                    var i = this.meanRssi - t.rssi;
                    i < 0.3
                      ? (e = 1 + i / 2)
                      : i >= 0.3 && i < 1
                        ? (e = 1.5 + i / 3)
                        : i >= 1 && i < 2
                          ? (e = 2.5 + i / 2)
                          : i >= 2 && (e = 3.5 + i / 2);
                  }
                  return e;
                },
              },
              {
                key: "transPosition",
                value: function (t) {
                  this.transParam &&
                    ((t.x =
                      t.x * Math.cos(this.transParam.theta) -
                      t.y * Math.sin(this.transParam.theta) +
                      this.transParam.x),
                    (t.y =
                      t.x * Math.sin(this.transParam.theta) +
                      t.y * Math.cos(this.transParam.theta) +
                      this.transParam.y));
                },
              },
            ]),
            t
          );
        })();
      e.AoaLocator = a;
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.MotionDetector = void 0);
      var n = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        s = i(2),
        r = i(4),
        o = i(0);
      function a(t, e) {
        if (!(t instanceof e))
          throw new TypeError("Cannot call a class as a function");
      }
      var h = i(9),
        l = (function () {
          function t(e) {
            a(this, t),
              (this.outDir = e),
              (this.stepStr = ""),
              (this.peakStr = ""),
              (this.validPeakStr = ""),
              (this.interpResultStr = "");
          }
          return (
            n(t, [
              {
                key: "createResultStr",
                value: function (t, e, i, n) {
                  return (
                    t +
                    "," +
                    e.toFixed(1) +
                    "," +
                    i.toFixed(1) +
                    "," +
                    n.toFixed(1) +
                    "\n"
                  );
                },
              },
              {
                key: "saveInterpResult",
                value: function (t, e) {
                  this.interpResultStr += t + "," + e + "\n";
                },
              },
              {
                key: "saveStepResult",
                value: function (t, e, i, n) {
                  this.stepStr += this.createResultStr(t, e, i, n);
                },
              },
              {
                key: "savePeakResult",
                value: function (t, e, i, n) {
                  this.peakStr += this.createResultStr(t, e, i, n);
                },
              },
              {
                key: "saveValidPeakResult",
                value: function (t, e, i, n) {
                  this.validPeakStr += this.createResultStr(t, e, i, n);
                },
              },
              {
                key: "save2File",
                value: function (t, e) {
                  h.writeFileSync(this.outDir + "_" + t, e, function (t) {
                    t && console.error(t);
                  });
                },
              },
              {
                key: "saveAll",
                value: function () {
                  this.stepStr &&
                    this.save2File("stepResult.csv", this.stepStr),
                    this.peakStr &&
                      this.save2File("peakResult.csv", this.peakStr),
                    this.interpResultStr &&
                      this.save2File("interpResult.csv", this.interpResultStr);
                },
              },
            ]),
            t
          );
        })(),
        c = (function () {
          function t(e) {
            a(this, t),
              (e = e || {}),
              (this.startTime = e.startTime || new Date().getTime());
            var i = e.outDir;
            (this.accFreq = 50),
              (this.headingFreq = 50),
              (this.stepDector = new u(i)),
              this.reset(e),
              this.setParams(e);
          }
          return (
            n(t, [
              {
                key: "reset",
                value: function (t) {
                  (this.startTime =
                    t && t.startTime ? t.startTime : new Date().getTime()),
                    (this.motionState = o.MOTION_STATE.UNCERTAIN),
                    (this.checkTime = this.startTime),
                    (this.accCompBufferLen = 25),
                    (this.accCompBuffer = new Array(this.accCompBufferLen)),
                    (this.index = 0),
                    (this.gravityList = []),
                    (this.gravityTimeLen = 5e3),
                    (this.placementCheckLen = 1500),
                    (this.accSensorStatus =
                      o.CONSTANTS.ACC_SENSOR_STATUS.NORMAL),
                    (this.phonePlacement = o.CONSTANTS.PHONE_PLACEMENT.HOLD),
                    (this.headingFreq = null),
                    (this.heading = null),
                    (this.headingList = []),
                    (this.meanNaviHeadingDiff = 0),
                    (this.headingListTimeLen = 3e3),
                    (this.headingDiff = 0),
                    (this.stepsForTurn = []),
                    (this.stepList = []),
                    (this.stepListTime = 4e3),
                    (this.stepFreq = 0),
                    (this.lowCnt = 0),
                    (this.motionResult = {
                      t: this.startTime,
                      stepDetected: !1,
                      step: null,
                      phonePlacement: this.phonePlacement,
                      motionState: this.motionState,
                      turnDetected: !1,
                      turnAngle: 0,
                    });
                },
              },
              {
                key: "setParams",
                value: function (t) {
                  (t = t || {}), (this.stepLen = t.stepLen ? t.stepLen : 0.7);
                },
              },
              {
                key: "detectTurn",
                value: function (t) {
                  var e = { turnDetected: !1, turnAngle: 0 };
                  if (t.length <= 1) return e;
                  for (
                    var i = t[t.length - 1], n = 0, r = t.length - 2;
                    r >= 0;
                    r--
                  ) {
                    var o = s.LocationUtils.angleDiff(i, t[r]);
                    Math.abs(o) > Math.abs(n) && (n = o);
                  }
                  return (
                    Math.abs(n) >= 45 &&
                      Math.abs(i - t[t.length - 2]) < 15 &&
                      (e = { turnDetected: !0, turnAngle: n }),
                    e
                  );
                },
              },
              { key: "detectDrivingTurn", value: function (t) {} },
              {
                key: "detectMotion",
                value: function (t, e, i, n) {
                  if (0 === e.x && 0 === e.y && 0 === e.z)
                    return this.motionResult;
                  var s = Math.sqrt(e.x * e.x + e.y * e.y + e.z * e.z),
                    r =
                      this.accCompBuffer[
                        (this.index - 1 + this.accCompBufferLen) %
                          this.accCompBufferLen
                      ];
                  this.saveAccData(t, i, s),
                    t - this.startTime >= 5e3 && this.checkPhonePlacement(t);
                  var o = this.stepDector.detectStep(t, s, r, n),
                    a = null,
                    h = { turnDetected: !1, turnAngle: 0 };
                  if (o) {
                    for (
                      a = {
                        t: t,
                        stepLen: this.stepLen,
                        heading: this.heading,
                      },
                        this.stepList.push(a),
                        this.stepsForTurn.push(a);
                      (this.stepsForTurn.length > 0 &&
                        t - this.stepsForTurn[0].t > 4e3) ||
                      this.stepsForTurn.length > 6;

                    )
                      this.stepsForTurn.shift();
                    (h = this.detectTurn(
                      this.stepsForTurn.map(function (t) {
                        return t.heading;
                      }),
                    )).turnDetected &&
                      this.stepsForTurn.length > 2 &&
                      (this.stepsForTurn = this.stepsForTurn.slice(
                        this.stepsForTurn.length - 2,
                        this.stepsForTurn.length,
                      ));
                  }
                  for (
                    ;
                    this.stepList.length > 0 &&
                    t - this.stepList[0].t > this.stepListTime;

                  )
                    this.stepList.shift();
                  return (
                    (this.motionState = this.checkMotionState(
                      t,
                      this.stepList,
                      this.accCompBuffer,
                    )),
                    (this.motionResult = Object.assign(
                      {
                        t: t,
                        stepDetected: o,
                        step: a,
                        phonePlacement: this.phonePlacement,
                        motionState: this.motionState,
                      },
                      h,
                    )),
                    this.motionResult
                  );
                },
              },
              {
                key: "checkMotionState",
                value: function (t, e, i) {
                  if (t - this.checkTime >= 500) {
                    this.checkTime = t;
                    var n = this.motionState;
                    this.stepFreq = (e.length / this.stepListTime) * 1e3;
                    var r = s.LocationUtils.standardDeviation(i);
                    n === o.MOTION_STATE.UNCERTAIN ||
                    n === o.MOTION_STATE.STATIC
                      ? this.stepFreq >= 1 &&
                        r > 1 &&
                        (this.motionState = o.MOTION_STATE.WALKING)
                      : n === o.MOTION_STATE.WALKING &&
                        this.stepFreq <= 0.75 &&
                        r < 0.7 &&
                        (this.motionState = o.MOTION_STATE.STATIC);
                  }
                  return this.motionState;
                },
              },
              {
                key: "updateHeading",
                value: function (t, e, i) {
                  this.heading &&
                    (this.headingDiff = s.LocationUtils.angleDiff(
                      e - this.headingDiff,
                    )),
                    (this.heading = e);
                  var n = null != i ? s.LocationUtils.angleDiff(i, e) : 0;
                  for (
                    this.headingList.push({
                      heading: this.heading,
                      t: t,
                      diff2Kf: n,
                    });
                    this.headingList.length > 0 &&
                    t - this.headingList[0].t > this.headingListTimeLen;

                  )
                    this.headingList.shift();
                  this.calHeadingSenorFreq(t);
                },
              },
              {
                key: "getPdrDisplacement",
                value: function (t, e) {
                  for (var i = 0, n = 0, s = 0; s < this.stepList.length; s++) {
                    var o = this.stepList[s];
                    o.timestamp >= t - e &&
                      ((i +=
                        this.stepLen *
                        Math.sin(r.Numerical.DEG2RAD * o.heading)),
                      (n +=
                        this.stepLen *
                        Math.cos(r.Numerical.DEG2RAD * o.heading)));
                  }
                  return [i, n];
                },
              },
              {
                key: "getHeading2Navi",
                value: function () {
                  return this.headingList.length > 0
                    ? this.headingList.reduce(function (t, e) {
                        return t + e.diff2Navi;
                      }, 0) / this.headingList.length
                    : 0;
                },
              },
              {
                key: "getHeading2Kf",
                value: function () {
                  return this.headingList.length > 0
                    ? this.headingList.reduce(function (t, e) {
                        return t + e.diff2Kf;
                      }, 0) / this.headingList.length
                    : 0;
                },
              },
              {
                key: "calHeadingSenorFreq",
                value: function (t) {
                  t - this.startTime >= this.headingListTimeLen &&
                    (this.headingFreq =
                      (this.headingList.length / this.headingListTimeLen) *
                      1e3);
                },
              },
              {
                key: "checkHasHeading",
                value: function () {
                  setTimeout(function () {}, 3e3);
                },
              },
              {
                key: "getHeadingDiff",
                value: function () {
                  return this.headingDiff;
                },
              },
              { key: "compareWithNaviDirection", value: function (t) {} },
              { key: "compareWithBTHeading", value: function () {} },
              {
                key: "saveAccData",
                value: function (t, e, i) {
                  if (e) {
                    e.t = t;
                    var n = Math.sqrt(e.x * e.x + e.y * e.y + e.z * e.z),
                      s = Math.sqrt(e.x * e.x + e.y * e.y);
                    for (
                      e.norm = n, e.gxy_norm = s, this.gravityList.push(e);
                      this.gravityList.length > 0 &&
                      t - this.gravityList[0].t > this.gravityTimeLen;

                    )
                      this.gravityList.shift();
                    var r = this.gravityList.length;
                    r > 250 &&
                      (this.gravityList = this.gravityList.slice(r - 250, r)),
                      (this.accCompBuffer[this.index] = i),
                      (this.index = (this.index + 1) % this.accCompBufferLen);
                  }
                },
              },
              {
                key: "checkAccSensorMode",
                value: function (t) {
                  t - this.startTime < 2e4 ||
                    (this.gravityList &&
                      0 === this.gravityList.length &&
                      (this.accSensorStatus =
                        o.CONSTANTS.ACC_SENSOR_STATUS.EMPTY),
                    this.accCompBuffer.reduce(function (t, e) {
                      return t + e;
                    }, 0) /
                      this.accCompBufferLen >
                      9 &&
                      ((this.accFreq =
                        (1e3 * this.gravityList.length) / this.gravityTimeLen),
                      this.accFreq < 13
                        ? (this.lowCnt += 1)
                        : this.accFreq >= 22 &&
                          ((this.lowCnt = 0),
                          (this.accSensorStatus =
                            o.CONSTANTS.ACC_SENSOR_STATUS.NORMAL)),
                      this.lowCnt > 5 &&
                        (this.accSensorStatus =
                          o.CONSTANTS.ACC_SENSOR_STATUS.LOW_FREQ)));
                },
              },
              {
                key: "checkPhonePlacement",
                value: function (t) {
                  var e = this,
                    i = this.gravityList.filter(function (i) {
                      return i.t >= t - e.placementCheckLen;
                    }),
                    n = this.phonePlacement,
                    r = this.phonePlacement;
                  if (i.length > 0) {
                    var a = i.length,
                      h =
                        (i
                          .map(function (t) {
                            return t.y;
                          })
                          .reduce(function (t, e) {
                            return t + e;
                          }, 0),
                        i
                          .map(function (t) {
                            return t.z;
                          })
                          .reduce(function (t, e) {
                            return t + e;
                          }, 0) / a);
                    h = Math.abs(h);
                    var l =
                        i
                          .map(function (t) {
                            return t.norm;
                          })
                          .reduce(function (t, e) {
                            return t + e;
                          }, 0) / a,
                      c = s.LocationUtils.standardDeviation(
                        i.map(function (t) {
                          return t.gxy_norm;
                        }),
                      );
                    n === o.CONSTANTS.PHONE_PLACEMENT.HOLD
                      ? ((h < 5.886 && c > 3) || c > 4) &&
                        (r = o.CONSTANTS.PHONE_PLACEMENT.OTHER)
                      : n === o.CONSTANTS.PHONE_PLACEMENT.OTHER &&
                        c < 2.5 &&
                        l > 8.81 &&
                        l < 10.81 &&
                        h > 4.4145 &&
                        (r = o.CONSTANTS.PHONE_PLACEMENT.HOLD);
                  }
                  this.phonePlacement = r;
                },
              },
              {
                key: "getAccSensorStatus",
                value: function () {
                  return this.accSensorStatus;
                },
              },
              {
                key: "showResultOnScreen",
                value: function (t, e, i) {
                  var n =
                    "--- gzMean" +
                    e.toFixed(1) +
                    " gNormM=" +
                    i.toFixed(1) +
                    " freq=" +
                    this.accFreq.toFixed(1);
                  console.log(t, e, i),
                    this.phonePlacement === o.CONSTANTS.PHONE_PLACEMENT.HOLD
                      ? (n += " hold")
                      : this.phonePlacement ===
                          o.CONSTANTS.PHONE_PLACEMENT.OTHER
                        ? (n += " other")
                        : (n += " undefined"),
                    s.LocationUtils.debugMessage(n);
                },
              },
            ]),
            t
          );
        })(),
        u = (function () {
          function t(e) {
            a(this, t),
              (this.stepTime = 0),
              (this.stepCount = 0),
              e && (this.saver = new l(e)),
              this.reset();
          }
          return (
            n(t, [
              {
                key: "reset",
                value: function () {
                  (this.minPeakTh = 10.5),
                    (this.PeakValleyTh = 2),
                    (this.MinStepInterval = 330),
                    (this.MinPeakInterval = 200),
                    (this.PeakIntervalThHigh = 2e3),
                    (this.valleyValue = 100),
                    (this.valleyTime = 0),
                    (this.validValleyValue = 100),
                    (this.peakValleyPair = { peak: 0, valley: 100, pvDiff: 0 }),
                    (this.peakTime = 0),
                    (this.peakValleyDiffs = []),
                    (this.pvDiffsNum = 4),
                    (this.meanPeriod = 0.6),
                    (this.isDirectionUp = !1),
                    (this.continueUpCount = 0),
                    (this.continueUpFormerCount = 0);
                },
              },
              {
                key: "detectStep",
                value: function (t, e, i, n) {
                  var s = !1;
                  return (
                    (this.minPeakTh = null === n ? 11.1 : 10.7),
                    0 !== this.peakTime &&
                      this.peakValleyPair.pvDiff > this.PeakValleyTh &&
                      t - this.peakTime > this.MinPeakInterval &&
                      this.peakTime - this.stepTime > this.MinStepInterval &&
                      ((this.stepTime = this.peakTime),
                      (this.stepCount += 1),
                      this.saver &&
                        this.saver.saveStepResult(
                          this.stepTime,
                          this.peakValleyPair.peak,
                          this.peakValleyPair.valley,
                          this.PeakValleyTh,
                        ),
                      (s = !0)),
                    e < this.valleyValue &&
                      ((this.valleyValue = e), (this.valleyTime = t)),
                    (this.validValleyValue =
                      t - this.lastValleyVTime < 2 * this.MinStepInterval &&
                      this.lastValleyVTime > this.stepTime &&
                      this.lastValleyValue < this.valleyValue
                        ? this.lastValleyValue
                        : this.valleyValue),
                    0 !== i &&
                      1 === this.detectPeak(t, e, i) &&
                      i - this.validValleyValue > 1.3 &&
                      (this.saver &&
                        this.saver.savePeakResult(
                          t,
                          i,
                          this.validValleyValue,
                          i - this.validValleyValue,
                        ),
                      t - this.peakTime > this.MinPeakInterval &&
                        ((this.PeakValleyTh = this.peakValleyThresholdUpdate(
                          i - this.validValleyValue,
                        )),
                        (this.lastValleyValue = this.valleyValue),
                        (this.lastValleyVTime = this.valleyTime),
                        (this.valleyValue = 100),
                        (this.peakTime = t),
                        (this.peakValleyPair = {
                          peak: i,
                          valley: this.validValleyValue,
                          pvDiff: i - this.validValleyValue,
                        })),
                      t - this.peakTime <= this.MinPeakInterval &&
                        i > this.peakValleyPair.peak &&
                        ((this.peakTime = t),
                        (this.validValleyValue =
                          this.validValleyValue < this.peakValleyPair.valley
                            ? this.validValleyValue
                            : this.peakValleyPair.valley),
                        (this.peakValleyPair = {
                          peak: i,
                          valley: this.validValleyValue,
                          pvDiff: i - this.validValleyValue,
                        }))),
                    s
                  );
                },
              },
              {
                key: "detectPeak",
                value: function (t, e, i) {
                  var n = this.isDirectionUp,
                    s = 0;
                  return (
                    e > i
                      ? ((this.isDirectionUp = !0), this.continueUpCount++)
                      : e < i &&
                        ((this.continueUpFormerCount = this.continueUpCount),
                        (this.continueUpCount = 0),
                        (this.isDirectionUp = !1)),
                    i > this.minPeakTh &&
                      !this.isDirectionUp &&
                      n &&
                      (this.continueUpFormerCount >= 1 || i >= 12) &&
                      (s = 1),
                    s
                  );
                },
              },
              {
                key: "peakValleyThresholdUpdate",
                value: function (t) {
                  var e = this.PeakValleyTh;
                  return (
                    this.peakValleyDiffs.length >= this.pvDiffsNum &&
                      this.peakValleyDiffs.shift(),
                    this.peakValleyDiffs.push(t),
                    this.peakValleyDiffs.length === this.pvDiffsNum &&
                      (e = this.gradientThreshold(this.peakValleyDiffs)),
                    e
                  );
                },
              },
              {
                key: "gradientThreshold",
                value: function (t) {
                  this.PeakValleyTh;
                  var e =
                    t.reduce(function (t, e) {
                      return t + e;
                    }, 0) / this.pvDiffsNum;
                  return e >= 8
                    ? 4.3
                    : e >= 7 && e < 8
                      ? 3.3
                      : e >= 4 && e < 7
                        ? 2.3
                        : e >= 3 && e < 4
                          ? 2
                          : 1.7;
                },
              },
              {
                key: "saveResult",
                value: function () {
                  this.saver && this.saver.saveAll();
                },
              },
            ]),
            t
          );
        })();
      e.MotionDetector = c;
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.AreaChecker = void 0);
      var n = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        s = i(2),
        r = i(0),
        o = i(3),
        a = (function () {
          function t() {
            !(function (t, e) {
              if (!(t instanceof e))
                throw new TypeError("Cannot call a class as a function");
            })(this, t),
              (this.buildingInfos = {}),
              (this.wholeLocArea = { area: null, buildingCode: null }),
              (this.indoorAreas = []),
              (this.outsideAreas = []),
              (this.fp_start_areas = []),
              (this.fp_use_areas = []),
              (this.fp_floor_areas = []),
              this.reset();
          }
          return (
            n(t, [
              {
                key: "reset",
                value: function () {
                  this.res = { buildingCode: this.wholeLocArea.buildingCode };
                },
              },
              {
                key: "setParams",
                value: function (t) {
                  t || (t = {});
                },
              },
              {
                key: "loadIndoorAreas",
                value: function (t) {
                  t && (this.indoorAreas = this.indoorAreas.concat(t));
                },
              },
              {
                key: "loadOutsideAreas",
                value: function (t) {
                  t && (this.outsideAreas = this.outsideAreas.concat(t));
                },
              },
              {
                key: "addFingerprintAreas",
                value: function (t) {
                  t &&
                    ("fp_start_areas" in t &&
                      (this.fp_start_areas = this.fp_start_areas.concat(
                        t.fp_start_areas,
                      )),
                    "fp_use_areas" in t &&
                      (this.fp_use_areas = this.fp_use_areas.concat(
                        t.fp_use_areas,
                      )),
                    "fp_floor_areas" in t &&
                      (this.fp_floor_areas = this.fp_floor_areas.concat(
                        t.fp_floor_areas,
                      )));
                },
              },
              {
                key: "checkFingerprintStartArea",
                value: function (t, e) {
                  return s.LocationUtils.checkInRegion(
                    this.fp_start_areas,
                    t,
                    e,
                  );
                },
              },
              {
                key: "checkFingerprintUseArea",
                value: function (t, e) {
                  return s.LocationUtils.checkInRegion(this.fp_use_areas, t, e);
                },
              },
              {
                key: "checkFingerprintFloorArea",
                value: function (t, e) {
                  return s.LocationUtils.checkInRegion(this.fp_floor_areas, t);
                },
              },
              {
                key: "checkArea",
                value: function (t, e, i) {
                  var n = this.checkLocArea(t, e, i);
                  return s.LocationUtils.checkInRegion(
                    this.wholeLocArea.bufferArea,
                    t,
                  )
                    ? this.res
                    : ((this.res = n), n);
                },
              },
              {
                key: "checkLocArea",
                value: function (t, e, i) {
                  var n = this.wholeLocArea.buildingCode,
                    o = r.LOC_AREA_STATUS.UNSET;
                  if (!this.wholeLocArea.buildingCode) {
                    if (1 !== Object.keys(this.buildingInfos).length)
                      return (
                        0 === Object.keys(this.buildingInfos).length
                          ? console.error(
                              "no building info to get building code",
                            )
                          : console.error("多栋地图没有配置室外区域"),
                        {
                          isIndoor: !0,
                          buildingCode: void 0,
                          isBuilding: !0,
                          locStatus: r.LOC_AREA_STATUS.UNSET,
                        }
                      );
                    (this.wholeLocArea.buildingCode = Object.keys(
                      this.buildingInfos,
                    )[0]),
                      (this.wholeLocArea.area =
                        this.buildingInfos[
                          Object.keys(this.buildingInfos)[0]
                        ].area),
                      (n = this.wholeLocArea.buildingCode);
                  }
                  if (this.wholeLocArea.area)
                    if (
                      s.LocationUtils.checkInRegion(this.wholeLocArea.area, t)
                    ) {
                      if (
                        0 === Object.keys(this.buildingInfos).length &&
                        this.buildingInfos.constructor === Object
                      )
                        return {
                          isIndoor: !1,
                          buildingCode: n,
                          isBuilding: !1,
                          locStatus: r.LOC_AREA_STATUS.OUT_BUILDING,
                        };
                      for (var a in ((o = r.LOC_AREA_STATUS.OUT_BUILDING),
                      this.buildingInfos))
                        if (
                          s.LocationUtils.checkInRegion(
                            this.buildingInfos[a].area,
                            t,
                            e,
                          )
                        ) {
                          (o = r.LOC_AREA_STATUS.BUILDING),
                            (n = a),
                            i &&
                              i !== a &&
                              (i === this.wholeLocArea.buildingCode
                                ? ((n = i),
                                  (o = r.LOC_AREA_STATUS.OUT_BUILDING))
                                : s.LocationUtils.checkInRegion(
                                    this.buildingInfos[i].area,
                                    t,
                                    e,
                                  ) && (n = i));
                          break;
                        }
                      i &&
                        (i === this.wholeLocArea.buildingCode
                          ? (n = i)
                          : ((n = i), (o = r.LOC_AREA_STATUS.BUILDING)));
                    } else
                      (o = r.LOC_AREA_STATUS.OUT_BUILDING),
                        (t.z = e),
                        this.wholeLocArea &&
                          this.checkExceedLocationArea(
                            t,
                            this.wholeLocArea.area,
                          ) &&
                          (o = r.LOC_AREA_STATUS.EXCEED);
                  else o = r.LOC_AREA_STATUS.UNSET;
                  var h =
                    o === r.LOC_AREA_STATUS.UNSET ||
                    o === r.LOC_AREA_STATUS.BUILDING;
                  return {
                    isIndoor: this.getIndoorStatus(t, e, n, h),
                    buildingCode: n,
                    isBuilding: h,
                    locStatus: o,
                  };
                },
              },
              {
                key: "checkExceedLocationArea",
                value: function (t, e) {
                  var i = Number.MAX_VALUE;
                  return (
                    e.forEach(function (e) {
                      var n = o.Geometric.projectPoint2PolygonEdge(
                        t,
                        e.polygon,
                      )[0];
                      n < i && (i = n);
                    }),
                    i > 200
                  );
                },
              },
              {
                key: "getIndoorStatus",
                value: function (t, e, i, n) {
                  if (t) {
                    if (s.LocationUtils.checkInRegion(this.indoorAreas, t, e))
                      return !0;
                    if (s.LocationUtils.checkInRegion(this.outsideAreas, t, e))
                      return !1;
                  }
                  var r = n;
                  return (
                    n &&
                      this.buildingInfos[i] &&
                      this.buildingInfos[i].isOpenArea &&
                      (r = !1),
                    r
                  );
                },
              },
              {
                key: "loadBuildingArea",
                value: function (t, e, i, n, s) {
                  i
                    ? (void 0 === n && (n = !1),
                      (this.buildingInfos[t] = {
                        area: e,
                        isOpenArea: n,
                        bufferArea: s,
                      }))
                    : this.wholeLocArea.buildingCode
                      ? console.error("multiple outside area")
                      : (this.wholeLocArea = {
                          buildingCode: t,
                          area: e,
                          bufferArea: s,
                        });
                },
              },
            ]),
            t
          );
        })();
      e.AreaChecker = a;
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.RoadNetData = void 0);
      var n = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        s = i(31),
        r = i(6),
        o = (function () {
          function t(e) {
            !(function (t, e) {
              if (!(t instanceof e))
                throw new TypeError("Cannot call a class as a function");
            })(this, t),
              (e = e || {}),
              (this.wlkRoadNet = null),
              (this.drvRoadNet = null);
          }
          return (
            n(t, [
              { key: "reset", value: function () {} },
              {
                key: "loadRoadInfo",
                value: function (t) {
                  if (
                    (t.walkingHmmInfo &&
                      t.walkingHmmInfo.roads &&
                      (this.wlkRoadNet = this.buildHmmInfo(t.walkingHmmInfo)),
                    t.drivingHmmInfo &&
                      t.drivingHmmInfo.roads &&
                      (this.drvRoadNet = this.buildHmmInfo(t.drivingHmmInfo)),
                    t.walking3HmmInfo && t.walking3HmmInfo.roads)
                  ) {
                    var e = this.apartRoads(
                      t.walking3HmmInfo.roads,
                      t.floorMap,
                    );
                    (this.wlkRoadNet = this.build3HmmInfo(
                      t.walking3HmmInfo,
                      e[0],
                    )),
                      (this.drvRoadNet = this.build3HmmInfo(
                        t.walking3HmmInfo,
                        e[1],
                      ));
                  }
                },
              },
              {
                key: "buildHmmInfo",
                value: function (t) {
                  var e = s.RoadDataProcessor.buildVertices(t.connection);
                  return {
                    vertices: e,
                    roads: s.RoadDataProcessor.buildHmmRoads(t.roads),
                    shortestDists: s.RoadDataProcessor.buildShortestDist(
                      t.roads,
                    ),
                    transFloorRoads: this.getTransFloorRoads(e),
                  };
                },
              },
              {
                key: "build3HmmInfo",
                value: function (t, e) {
                  var i = t.connection,
                    n = this.getTransPandF(i);
                  return { vertices: n[0], roads: e, transFloorRoads: n[1] };
                },
              },
              {
                key: "apartRoads",
                value: function (t, e) {
                  var i = [],
                    n = [];
                  for (var s in t)
                    for (var o in t[s]) {
                      var a = 0;
                      if (parseInt(o) < 1e4) a = 0;
                      else {
                        var h = o.slice(0, 1);
                        a = 1e4 * parseInt(h);
                      }
                      var l = t[s][o];
                      (l.buildingCode = this.findKey(e.mapIndex, a)),
                        l.mode.includes("walk") &&
                          (i[s] || (i[s] = []),
                          i[s].push(
                            new r.Road(
                              !0,
                              l.vertexes,
                              l.intersections,
                              l.factor,
                              l.buildingCode,
                            ),
                          ),
                          2 === l.vertexes.length &&
                            l.vertexes[0].constructor !== Array &&
                            i[s].push(
                              new r.Road(
                                !0,
                                l.vertexes.slice().reverse(),
                                void 0,
                                l.factor,
                                l.buildingCode,
                              ),
                            )),
                        l.mode.includes("car") &&
                          (n[s] || (n[s] = []),
                          n[s].push(
                            new r.Road(
                              !0,
                              l.vertexes,
                              l.intersections,
                              l.factor,
                              l.buildingCode,
                            ),
                          ),
                          2 === l.vertexes.length &&
                            l.vertexes[0].constructor !== Array &&
                            n[s].push(
                              new r.Road(
                                !0,
                                l.vertexes.slice().reverse(),
                                void 0,
                                l.factor,
                                l.buildingCode,
                              ),
                            ));
                    }
                  return [i, n];
                },
              },
              {
                key: "getTransFloorRoads",
                value: function (t) {
                  for (
                    var e = [],
                      i = (function (t) {
                        function e(e) {
                          return t.apply(this, arguments);
                        }
                        return (
                          (e.toString = function () {
                            return t.toString();
                          }),
                          e
                        );
                      })(function (i) {
                        var n = t[i];
                        n &&
                          void 0 !== n.type &&
                          n.ne.forEach(function (s) {
                            t[s].z !== n.z &&
                              (e[n.z] || (e[n.z] = []), e[n.z].push([i, s]));
                          });
                      }),
                      n = 0;
                    n < t.length;
                    n++
                  )
                    i(n);
                  return e;
                },
              },
              {
                key: "getTransPandF",
                value: function (t) {
                  var e = [],
                    i = [],
                    n = function (n) {
                      var s = t[n];
                      (i[n] = s),
                        s &&
                          void 0 !== s.type &&
                          s.ne.forEach(function (i) {
                            t[i].z !== s.z &&
                              (e[s.z] || (e[s.z] = []),
                              e[s.z].push([parseInt(n), i]));
                          });
                    };
                  for (var s in t) n(s);
                  return [i, e];
                },
              },
              {
                key: "findKey",
                value: function (t, e) {
                  for (var i in t) if (t[i] === e) return i;
                },
              },
            ]),
            t
          );
        })();
      e.RoadNetData = o;
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.RoadDataProcessor = void 0);
      var n = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        s = i(6),
        r = (function () {
          function t(e, i) {
            !(function (t, e) {
              if (!(t instanceof e))
                throw new TypeError("Cannot call a class as a function");
            })(this, t),
              (this._vertices = t.buildVertices(e)),
              (this._pathPlanRoads = t.buildPathPlanRoads(i)),
              t.buildVerticeFactor(this._vertices, this._pathPlanRoads),
              (this._hmmRoads = t.buildHmmRoads(i)),
              (this._shortestDist = t.buildShortestDist(i));
          }
          return (
            n(
              t,
              [
                {
                  key: "getHMMInfo",
                  value: function () {
                    return [this._vertices, this._hmmRoads, this._shortestDist];
                  },
                },
                {
                  key: "getPathPlanInfo",
                  value: function () {
                    return [this._vertices, this._pathPlanRoads];
                  },
                },
              ],
              [
                {
                  key: "buildVertices",
                  value: function (t) {
                    var e = [];
                    for (var i in t) {
                      var n = t[i];
                      e[i] = new s.Point(
                        n.x,
                        n.y,
                        n.re,
                        n.ne,
                        n.type,
                        n.cost,
                        n.factor,
                        n.special,
                      );
                    }
                    return e;
                  },
                },
                {
                  key: "buildPathPlanRoads",
                  value: function (t) {
                    var e = t.roads,
                      i = [];
                    for (var n in e) {
                      i[n] = [];
                      var r = !0,
                        o = !1,
                        a = void 0;
                      try {
                        for (
                          var h, l = e[n][Symbol.iterator]();
                          !(r = (h = l.next()).done);
                          r = !0
                        ) {
                          var c = h.value;
                          i[n].push(
                            new s.Road(
                              c.one_way,
                              c.vertexes,
                              c.intersections,
                              c.factor,
                              c.buildingCode,
                              c.mode,
                            ),
                          );
                        }
                      } catch (t) {
                        (o = !0), (a = t);
                      } finally {
                        try {
                          !r && l.return && l.return();
                        } finally {
                          if (o) throw a;
                        }
                      }
                    }
                    return i;
                  },
                },
                {
                  key: "buildVerticeFactor",
                  value: function (t, e, i) {
                    for (var n in e) {
                      var r = e[n],
                        o = !0,
                        a = !1,
                        h = void 0;
                      try {
                        for (
                          var l, c = r[Symbol.iterator]();
                          !(o = (l = c.next()).done);
                          o = !0
                        ) {
                          var u = l.value;
                          if (u.type === s.RoadType.LINE)
                            for (var f = 1; f < u.vertexes.length; f++) {
                              var d = u.vertexes[f - 1],
                                v = u.vertexes[f];
                              (t[d].factor[v] = u.factor),
                                i &&
                                  u.mode &&
                                  -1 === u.mode.indexOf(i) &&
                                  (t[d].factor[v] = 1e4 * u.factor),
                                u.isOneWay ||
                                  ((t[v].factor[d] = u.factor),
                                  i &&
                                    u.mode &&
                                    -1 === u.mode.indexOf(i) &&
                                    (t[v].factor[d] = 1e4 * u.factor));
                            }
                          else if (1 !== u.factor) {
                            var p = void 0,
                              y = 1;
                            switch (
                              (i &&
                                u.mode &&
                                -1 === u.mode.indexOf(i) &&
                                (y = 1e4),
                              u.type)
                            ) {
                              case s.RoadType.MULTIPOLYGON:
                                var m = u.intersections,
                                  g = !0,
                                  x = !1,
                                  b = void 0;
                                try {
                                  for (
                                    var k, T = u.vertexes[Symbol.iterator]();
                                    !(g = (k = T.next()).done);
                                    g = !0
                                  ) {
                                    var P = k.value;
                                    m = m.concat(P);
                                  }
                                } catch (t) {
                                  (x = !0), (b = t);
                                } finally {
                                  try {
                                    !g && T.return && T.return();
                                  } finally {
                                    if (x) throw b;
                                  }
                                }
                                p = new Set(m);
                                break;
                              default:
                                p = new Set(u.intersections.concat(u.vertexes));
                            }
                            var M = !0,
                              S = !1,
                              _ = void 0;
                            try {
                              for (
                                var O, I = p[Symbol.iterator]();
                                !(M = (O = I.next()).done);
                                M = !0
                              ) {
                                var L = O.value,
                                  A = !0,
                                  D = !1,
                                  R = void 0;
                                try {
                                  for (
                                    var C, N = p[Symbol.iterator]();
                                    !(A = (C = N.next()).done);
                                    A = !0
                                  ) {
                                    var w = C.value;
                                    t[L].factor[w] = u.factor * y;
                                  }
                                } catch (t) {
                                  (D = !0), (R = t);
                                } finally {
                                  try {
                                    !A && N.return && N.return();
                                  } finally {
                                    if (D) throw R;
                                  }
                                }
                              }
                            } catch (t) {
                              (S = !0), (_ = t);
                            } finally {
                              try {
                                !M && I.return && I.return();
                              } finally {
                                if (S) throw _;
                              }
                            }
                          }
                        }
                      } catch (t) {
                        (a = !0), (h = t);
                      } finally {
                        try {
                          !o && c.return && c.return();
                        } finally {
                          if (a) throw h;
                        }
                      }
                    }
                  },
                },
                {
                  key: "buildHmmRoads",
                  value: function (t) {
                    var e = t.roads,
                      i = [];
                    for (var n in e) {
                      i[n] = [];
                      var r = !0,
                        o = !1,
                        a = void 0;
                      try {
                        for (
                          var h, l = e[n][Symbol.iterator]();
                          !(r = (h = l.next()).done);
                          r = !0
                        ) {
                          var c = h.value;
                          i[n].push(
                            new s.Road(
                              !0,
                              c.vertexes,
                              c.intersections,
                              c.factor,
                              c.buildingCode,
                            ),
                          ),
                            2 === c.vertexes.length &&
                              c.vertexes[0].constructor !== Array &&
                              i[n].push(
                                new s.Road(
                                  !0,
                                  c.vertexes.slice().reverse(),
                                  void 0,
                                  c.factor,
                                  c.buildingCode,
                                ),
                              );
                        }
                      } catch (t) {
                        (o = !0), (a = t);
                      } finally {
                        try {
                          !r && l.return && l.return();
                        } finally {
                          if (o) throw a;
                        }
                      }
                    }
                    return i;
                  },
                },
                {
                  key: "buildShortestDist",
                  value: function (t) {
                    return t.shortestDistance;
                  },
                },
              ],
            ),
            t
          );
        })();
      e.RoadDataProcessor = r;
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.ZChecker = void 0);
      var n,
        s = function (t, e) {
          if (Array.isArray(t)) return t;
          if (Symbol.iterator in Object(t))
            return (function (t, e) {
              var i = [],
                n = !0,
                s = !1,
                r = void 0;
              try {
                for (
                  var o, a = t[Symbol.iterator]();
                  !(n = (o = a.next()).done) &&
                  (i.push(o.value), !e || i.length !== e);
                  n = !0
                );
              } catch (t) {
                (s = !0), (r = t);
              } finally {
                try {
                  !n && a.return && a.return();
                } finally {
                  if (s) throw r;
                }
              }
              return i;
            })(t, e);
          throw new TypeError(
            "Invalid attempt to destructure non-iterable instance",
          );
        },
        r = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        o = i(0),
        a = i(3),
        h = i(2),
        l = i(14),
        c = (n = i(5)) && n.__esModule ? n : { default: n },
        u = (function () {
          function t(e) {
            !(function (t, e) {
              if (!(t instanceof e))
                throw new TypeError("Cannot call a class as a function");
            })(this, t),
              (e = e || {}),
              (this.roadNetData = {}),
              (this.posMode = o.POSITION_MODE.WALKING),
              (this.pos2transLineTh = 7),
              (this.bt2Trans2pointTh = 6),
              (this.zWeightTh = 0.5),
              (this.geoZAreas = []),
              (this.zAreas = []),
              (this.id2Points = []),
              (this.roads = []),
              (this.transFloorRoads = []),
              (this.shortestDists = []),
              (this.locationZs = []),
              this.setParams(e),
              this.reset();
          }
          return (
            r(t, [
              {
                key: "reset",
                value: function () {
                  (this.lastZChangeTime = 0),
                    (this.inTrsFloorRegion = !1),
                    (this.geoAreaId = void 0),
                    (this.geoAreaCnt = 0),
                    (this.z = void 0);
                },
              },
              {
                key: "setParams",
                value: function (t) {
                  t || (t = {}),
                    (this.wlkPos2transLineTh = t.wlkPos2transLineTh
                      ? t.wlkPos2transLineTh
                      : 7),
                    (this.wlkBt2Trans2pointTh = t.wlkBt2Trans2pointTh
                      ? t.wlkBt2Trans2pointTh
                      : 6),
                    (this.drvPos2transLineTh = t.drvPos2transLineTh
                      ? t.drvPos2transLineTh
                      : 20),
                    (this.drvBt2Trans2pointTh = t.drvBt2Trans2pointTh
                      ? t.drvBt2Trans2pointTh
                      : 20),
                    (this.wlkZWeightTh = t.wlkZWeightTh ? t.wlkZWeightTh : 0.7),
                    (this.drvZWeightTh = t.drvZWeightTh ? t.drvZWeightTh : 0.5),
                    this.paramsFresh();
                },
              },
              {
                key: "paramsFresh",
                value: function () {
                  this.posMode === o.POSITION_MODE.WALKING
                    ? ((this.pos2transLineTh = this.wlkPos2transLineTh),
                      (this.bt2Trans2pointTh = this.wlkBt2Trans2pointTh),
                      (this.zWeightTh = this.wlkZWeightTh))
                    : ((this.pos2transLineTh = this.drvPos2transLineTh),
                      (this.bt2Trans2pointTh = this.drvBt2Trans2pointTh),
                      (this.zWeightTh = this.drvZWeightTh));
                },
              },
              {
                key: "loadZAreas",
                value: function (t, e) {
                  e &&
                    (e.forEach(function (e) {
                      (e.buidingCode = t),
                        void 0 === e.z &&
                          ((e.z = 0), console.warn("no z in area info of:", t));
                    }),
                    (this.zAreas = this.zAreas.concat(e)));
                },
              },
              {
                key: "addGeoZAreas",
                value: function (t) {
                  t &&
                    (t.forEach(function (t) {
                      void 0 === t.z &&
                        ((t.z = 0), console.warn("no z in area"));
                    }),
                    (this.geoZAreas = this.geoZAreas.concat(t)));
                },
              },
              {
                key: "setParams2posMode",
                value: function (t) {
                  this.posMode = void 0 !== t ? t : o.POSITION_MODE.WALKING;
                  var e =
                    t === o.POSITION_MODE.WALKING
                      ? this.roadNetData.wlkRoadNet
                      : this.roadNetData.drvRoadNet;
                  e
                    ? ((this.id2Points = e.vertices),
                      (this.roads = e.roads),
                      (this.transFloorRoads = e.transFloorRoads),
                      (this.shortestDists = e.shortestDists),
                      (this.locationZs = Object.keys(this.roads).map(
                        parseFloat,
                      )))
                    : console.error(
                        "no road net for position mode:",
                        t === o.POSITION_MODE.WALKING ? "walking" : "driving",
                      ),
                    this.paramsFresh();
                },
              },
              {
                key: "setRoadNet",
                value: function (t) {
                  this.roadNetData = t;
                },
              },
              {
                key: "calShortestRouteDistance",
                value: function (t, e) {
                  var i =
                      arguments.length > 2 && void 0 !== arguments[2]
                        ? arguments[2]
                        : 1,
                    n =
                      arguments.length > 3 && void 0 !== arguments[3]
                        ? arguments[3]
                        : 2;
                  if (t.z !== e.z) return -1;
                  var s = [],
                    r = [],
                    o = void 0,
                    h = void 0;
                  for (var c in this.roads[t.z]) {
                    var u = a.Geometric.projectPoint2Road(
                        t,
                        this.roads[t.z][c],
                        this.id2Points,
                      )[0],
                      f = a.Geometric.projectPoint2Road(
                        e,
                        this.roads[e.z][c],
                        this.id2Points,
                      )[0];
                    u < i && s.push(c), f < n && r.push(c);
                  }
                  var d = Number.MAX_VALUE,
                    v = !0,
                    p = !1,
                    y = void 0;
                  try {
                    for (
                      var m, g = s[Symbol.iterator]();
                      !(v = (m = g.next()).done);
                      v = !0
                    ) {
                      o = m.value;
                      var x = !0,
                        b = !1,
                        k = void 0;
                      try {
                        for (
                          var T, P = r[Symbol.iterator]();
                          !(x = (T = P.next()).done);
                          x = !0
                        ) {
                          h = T.value;
                          var M = l.HMM.routeDistance(
                            t,
                            o,
                            e,
                            h,
                            this.roads,
                            this.id2Points,
                            this.shortestDists,
                          )[0];
                          M < d && (d = M);
                        }
                      } catch (t) {
                        (b = !0), (k = t);
                      } finally {
                        try {
                          !x && P.return && P.return();
                        } finally {
                          if (b) throw k;
                        }
                      }
                    }
                  } catch (t) {
                    (p = !0), (y = t);
                  } finally {
                    try {
                      !v && g.return && g.return();
                    } finally {
                      if (p) throw y;
                    }
                  }
                  return d;
                },
              },
              {
                key: "getTransType",
                value: function (t) {
                  if (t.type) {
                    if (1 !== t.type.length) return "compound floor transition";
                    switch (t.type[0]) {
                      case 1024:
                        return "escalator";
                      case 3:
                        return "lift";
                      case 6:
                        return "stairs";
                    }
                  }
                },
              },
              {
                key: "checkZByBt",
                value: function (t, e, i, n, r, l) {
                  if (e && i && !(0 !== l && void 0 === this.z && i.m < -80)) {
                    var u = this.z,
                      f = void 0;
                    if (((e.z = this.z), void 0 === this.z || n === this.z))
                      u = n;
                    else if (r > this.zWeightTh)
                      if (
                        this.transFloorRoads &&
                        this.transFloorRoads[this.z]
                      ) {
                        if (t - this.lastZChangeTime >= 4e3)
                          for (
                            var d = 0;
                            d < this.transFloorRoads[this.z].length;
                            d++
                          ) {
                            var v = s(this.transFloorRoads[this.z][d], 2),
                              p = v[0],
                              y = v[1],
                              m = this.id2Points[p],
                              g = this.id2Points[y];
                            if (
                              h.LocationUtils.distance(g, i) <
                              this.bt2Trans2pointTh
                            ) {
                              var x = void 0,
                                b = void 0;
                              if (n <= -1e4) {
                                this.inTrsFloorRegion = !0;
                                break;
                              }
                              if (m.type[0] === o.TRANS_FLOOR_TYPE.LIFT) {
                                var k = (0, c.default)(g);
                                (k.z = n),
                                  (x = this.calShortestRouteDistance(k, i));
                              } else
                                g.z === n &&
                                  (x =
                                    this.posMode === o.POSITION_MODE.DRIVING
                                      ? a.Geometric.euclideanDistance(g, i)
                                      : this.calShortestRouteDistance(g, i));
                              if (
                                ((b = a.Geometric.projectPoint2Segment(
                                  e,
                                  m,
                                  g,
                                )[0]),
                                (6 !== m.type[0] &&
                                  1024 !== m.type[0] &&
                                  3 !== m.type[0]) ||
                                  (b -= 6),
                                this.inTrsFloorRegion ||
                                  (x >= 0 &&
                                    x < this.bt2Trans2pointTh &&
                                    b < this.pos2transLineTh))
                              ) {
                                var T = this.getTransType(m);
                                T &&
                                  (console.log(
                                    "z changed through:" + T,
                                    this.z + "->" + n,
                                    "bt2transPoint:",
                                    x,
                                    "dis2line:",
                                    b,
                                  ),
                                  (u = n),
                                  (f = [g]),
                                  h.LocationUtils.distance(m, g) > 6 &&
                                    6 === m.type[0] &&
                                    f.push("straightStairs"));
                                break;
                              }
                            }
                          }
                      } else
                        console.warn(
                          "no transition floor points in floor:",
                          this.z,
                          n,
                        ),
                          (u = n);
                    return n > -1e4 && (this.inTrsFloorRegion = !1), [u, f];
                  }
                },
              },
              {
                key: "getAreaZ",
                value: function (t, e, i) {
                  var n = void 0,
                    s = void 0;
                  return (
                    i &&
                      e &&
                      (s = h.LocationUtils.checkInWhichRegion(i, e)) > -1 &&
                      (n = i[s].z),
                    [n, s]
                  );
                },
              },
              {
                key: "checkZByArea",
                value: function (t, e) {
                  var i = void 0;
                  if (void 0 === this.z) {
                    var n = this.getAreaZ(t, e, this.geoZAreas)[1];
                    void 0 === n ||
                    -1 === n ||
                    (void 0 !== this.geoAreaId && n !== this.geoAreaId)
                      ? (this.geoAreaCnt = 0)
                      : ((this.geoAreaId = n), (this.geoAreaCnt += 1)),
                      this.geoAreaCnt >= 3 && (i = this.geoZAreas[n].z);
                  } else (this.geoAreaId = void 0), (this.geoAreaCnt = 0);
                  return (
                    void 0 === i && (i = this.getAreaZ(t, e, this.zAreas)[0]), i
                  );
                },
              },
              {
                key: "checkZByAoa",
                value: function (t, e, i) {
                  var n = void 0;
                  return (!t || t.m < -90) && i && (n = i.z), n;
                },
              },
              {
                key: "checkZ",
                value: function (t, e, i, n, s, r, o, a, h, l, c) {
                  var u = this.checkZByAoa(i, o, l),
                    f = this.checkZByArea(t, e, i),
                    d = void 0,
                    v = void 0;
                  if (
                    (((void 0 === this.z && i && i.s && 0 !== n && s <= 0.6) ||
                      (o && o.t > t - 1600 && !a && n > 0 && o.c < 7)) &&
                      ((i = null), (this.z = 0)),
                    s > 1 && e && i && n > -1e4 && a)
                  )
                    d = n;
                  else if (void 0 !== u) d = u;
                  else if (null != f) d = f;
                  else if (c && void 0 !== c.type && 1 === c.type[0]) {
                    var p = !0,
                      y = !1,
                      m = void 0;
                    try {
                      for (
                        var g, x = c.ne[Symbol.iterator]();
                        !(p = (g = x.next()).done);
                        p = !0
                      ) {
                        var b = g.value;
                        this.id2Points[b].z != this.z &&
                          this.id2Points[b].z === n &&
                          ((d = this.id2Points[b].z), console.log("slop"));
                      }
                    } catch (t) {
                      (y = !0), (m = t);
                    } finally {
                      try {
                        !p && x.return && x.return();
                      } finally {
                        if (y) throw m;
                      }
                    }
                  } else {
                    var k = this.checkZByBt(t, e, i, n, s, h);
                    void 0 !== k && k[0] > -1e4 && ((d = k[0]), (v = k[1]));
                  }
                  return (
                    null != d &&
                      this.z !== d &&
                      this.locationZs.includes(d) &&
                      ((this.z = d), (this.lastZChangeTime = t)),
                    [this.z, v]
                  );
                },
              },
            ]),
            t
          );
        })();
      e.ZChecker = u;
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.ModelManager = void 0);
      var s = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        r = i(8),
        o = i(34),
        a = i(19),
        h = i(0),
        l = i(2),
        c = i(3),
        u = i(4),
        f = (function (t) {
          function e(t) {
            !(function (t, e) {
              if (!(t instanceof e))
                throw new TypeError("Cannot call a class as a function");
            })(this, e);
            var i = (function (t, e) {
              if (!t)
                throw new ReferenceError(
                  "this hasn't been initialised - super() hasn't been called",
                );
              return !e || ("object" != n(e) && "function" != typeof e) ? t : e;
            })(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this));
            return (
              (i.option = t || {}),
              (i.started = !1),
              (i.callNav = !1),
              (i.delayCnt = 0),
              (i.z = void 0),
              (i.startTime = t.startTime || new Date().getTime()),
              (i.t = i.startTime),
              (i.pdrKf = new a.KalmanFilterPDR(
                i.t,
                h.KF_TYPE.PDR_WLK,
                t.deviceType,
              )),
              (i.diffKf = new o.KalmanFilterDiffHeading(
                i.t,
                h.KF_TYPE.DIFF_WLK,
                t.deviceType,
              )),
              (i.baseKf = new o.KalmanFilterDiffHeading(
                i.t,
                h.KF_TYPE.DIFF_BASE,
                t.deviceType,
              )),
              (i.drvKf = new o.KalmanFilterDiffHeading(
                i.t,
                h.KF_TYPE.DIFF_DRV,
                t.deviceType,
              )),
              (i.deviceType =
                void 0 !== t.deviceType
                  ? t.deviceType
                  : h.CONSTANTS.DEVICE.ANDROID),
              i.deviceType === h.CONSTANTS.DEVICE.ANDROID
                ? (i.drvOutKF = new o.KalmanFilterDiffHeading(
                    i.t,
                    h.KF_TYPE.DIFF_DRV_OUT_AND,
                    t.deviceType,
                  ))
                : (i.drvOutKF = new o.KalmanFilterDiffHeading(
                    i.t,
                    h.KF_TYPE.DIFF_DRV_OUT_IOS,
                    t.deviceType,
                  )),
              (i.lastPos = null),
              (i.noSignal = !1),
              (i.signalList = []),
              i.reset(),
              i.setParams(t),
              i
            );
          }
          return (
            (function (t, e) {
              if ("function" != typeof e && null !== e)
                throw new TypeError(
                  "Super expression must either be null or a function, not " +
                    n(e),
                );
              (t.prototype = Object.create(e && e.prototype, {
                constructor: {
                  value: t,
                  enumerable: !1,
                  writable: !0,
                  configurable: !0,
                },
              })),
                e &&
                  (Object.setPrototypeOf
                    ? Object.setPrototypeOf(t, e)
                    : (t.__proto__ = e));
            })(e, r.DEventDispatcherES6),
            s(e, [
              {
                key: "reset",
                value: function () {
                  (this.started = !1),
                    this.pdrKf.reset(),
                    this.diffKf.reset(),
                    this.baseKf.reset(),
                    this.drvKf.reset(),
                    this.drvOutKF.reset(),
                    (this.baseKfInfoList = []);
                },
              },
              {
                key: "reStartModels",
                value: function (t, e, i) {
                  this.pdrKf.startKF(t, e, i),
                    this.diffKf.startKF(t, e, i),
                    this.baseKf.startKF(t, e, i),
                    this.drvKf.startKF(t, e, i),
                    this.drvOutKF.startKF(t, e, i),
                    (this.baseKfInfoList = []);
                },
              },
              { key: "setParams", value: function (t) {} },
              {
                key: "setNoSignalState",
                value: function () {
                  this.noSignal = !0;
                },
              },
              {
                key: "checkStart",
                value: function (t, e) {
                  var i = !0;
                  return (
                    !this.noSignal ||
                      this.lastPos ||
                      e ||
                      (this.signalList.push(t),
                      t - this.signalList[0] < 3e3
                        ? (i = !1)
                        : ((this.noSignal = !1), (this.signalList = []))),
                    i
                  );
                },
              },
              {
                key: "checkInitSignal",
                value: function (t, e, i, n) {
                  var s = e && e.cMean < 3,
                    r = e && e.cMean < 7 && t - this.startTime >= 5e3,
                    o = i && i.c < 4 && t - this.startTime >= 3e3,
                    a = i && i.c < 7 && t - this.startTime >= 5e3,
                    h = n && n.c <= 8,
                    l = n && n.c <= 8 && t - this.startTime >= 5e3,
                    c = t - this.startTime >= 1e4 && (e || i || n);
                  return s || r || o || a || h || l || c;
                },
              },
              {
                key: "setLastPos",
                value: function (t) {
                  this.lastPos = t;
                },
              },
              {
                key: "updateFusionModels",
                value: function (t, e, i, n, s, r, o, a, h, l, c, f, d, v) {
                  this.started ||
                    (this.checkInitSignal(t, n, s, r) &&
                      ((this.t = t),
                      (this.started = this.checkStart(t, r)),
                      (this.z = e),
                      this.isLast2Init(this.lastPos, n, s, r))),
                    this.started &&
                      this.checkCallNavStart(t, n, i, f) &&
                      (e !== this.z &&
                        ((this.z = e), d || this.reStartModels(n, null, null)),
                      this.t,
                      (this.t = t),
                      this.pdrKf.update(t, n, s, r, o, a, h, l, c, v),
                      this.diffKf.update(t, n, s, r, o, l, c),
                      this.baseKf.update(t, n, s, r, void 0, c),
                      this.drvKf.update(t, n, s, r, o, !1, c),
                      this.drvOutKF.update(t, n, s, r, o, l),
                      this.updateBaseKfInfos(u.Numerical.rad2deg(o)));
                },
              },
              {
                key: "getStates",
                value: function (t, e, i) {
                  var n = void 0,
                    s = void 0,
                    r = void 0;
                  return (
                    t === h.POSITION_MODE.WALKING
                      ? ((n =
                          e === h.CONSTANTS.FUSION_MODEL.PDR
                            ? this.pdrKf.getPosition()
                            : this.diffKf.getPosition()),
                        (s = this.diffKf.getVelocity()))
                      : i === h.CONSTANTS.DRIVING_MODE.INDOOR
                        ? ((n = this.drvKf.getPosition()),
                          (s = this.drvKf.getVelocity()))
                        : ((n = this.drvOutKF.getPosition()),
                          (s = this.drvOutKF.getVelocity())),
                    s && (r = u.Numerical.rad2deg(Math.atan2(s.x, s.y))),
                    this.diffKf.getSpeed(),
                    { velocity: s, pos: n, heading: r }
                  );
                },
              },
              {
                key: "changeState",
                value: function (t, e) {
                  e === h.CONSTANTS.DRIVING_MODE.INDOOR
                    ? this.drvKf.tranState(
                        this.drvOutKF.getPosition(),
                        this.drvOutKF.getVelocity(),
                      )
                    : e === h.CONSTANTS.DRIVING_MODE.OUTDOOR &&
                      this.drvOutKF.tranState(
                        this.drvKf.getPosition(),
                        this.drvKf.getVelocity(),
                      );
                },
              },
              {
                key: "changeAoaState",
                value: function (t, e) {
                  t === h.CONSTANTS.FUSION_MODEL.PDR
                    ? this.pdrKf.setState(this.diffKf.getPosition())
                    : this.diffKf.kalmanModel &&
                      this.diffKf.tranState({ x: e.x, y: e.y }, { x: 0, y: 0 });
                },
              },
              {
                key: "displayKfDebugInfo",
                value: function (t, e, i, n) {
                  var s = this.pdrKf.getDspInfo(),
                    r = this.diffKf.getDspInfo(),
                    o = this.baseKf.getDspInfo(),
                    a =
                      "bt:" +
                      (e
                        ? " x:" + e.x.toFixed(1) + " y:" + e.y.toFixed(1)
                        : ""),
                    h =
                      "geo:" +
                      (i ? " x" + i.x.toFixed(1) + " y:" + i.y.toFixed(1) : ""),
                    c = "step:" + n,
                    u =
                      "b2p:" +
                      l.LocationUtils.distance(
                        this.baseKf.getPosition(),
                        this.pdrKf.getPosition(),
                      ).toFixed(1),
                    f =
                      "b2d:" +
                      l.LocationUtils.distance(
                        this.baseKf.getPosition(),
                        this.diffKf.getPosition(),
                      ).toFixed(1);
                  console.log(t, c, a, h, s, r, o, u, f);
                },
              },
              {
                key: "updateBaseKfInfos",
                value: function (t) {
                  if (this.started) {
                    var e = l.LocationUtils.distance(
                        this.baseKf.getPosition(),
                        this.pdrKf.getPosition(),
                      ),
                      i = c.Geometric.angleDiffDeg(
                        this.baseKf.getHeadingDeg(),
                        t,
                      );
                    for (
                      this.baseKfInfoList.push({
                        t: this.t,
                        speed: this.baseKf.getSpeed(),
                        pdr2baseDist: e,
                        cHeadDiff: i,
                      });
                      this.baseKfInfoList.length > 0 &&
                      this.t - this.baseKfInfoList[0].t > 6e3;

                    )
                      this.baseKfInfoList.shift();
                    for (
                      var n = this.baseKfInfoList.length,
                        s = 0,
                        r = 0,
                        o = 0,
                        a = 0;
                      a < n;
                      a++
                    )
                      (s += this.baseKfInfoList[a].speed),
                        (r += this.baseKfInfoList[a].pdr2baseDist),
                        (o += this.baseKfInfoList[a].cHeadDiff);
                    n > 0
                      ? ((this.mSpeed = s / n),
                        (this.mPdr2baseDist = r / n),
                        (this.mCHeadDiff = o / n))
                      : ((this.mSpeed = 0),
                        (this.mPdr2baseDist = 0),
                        (this.mCHeadDiff = 0));
                  } else this.baseKfInfoList = [];
                },
              },
              {
                key: "getBaseKfInfos",
                value: function () {
                  return {
                    timeInterval:
                      0 === this.baseKfInfoList.length
                        ? 0
                        : 1 === this.baseKfInfoList.length
                          ? 1e3
                          : this.baseKfInfoList[this.baseKfInfoList.length - 1]
                              .t - this.baseKfInfoList[0].t,
                    pos: this.baseKf.getPosition(),
                    head: this.baseKf.getHeadingDeg(),
                    mSpeed: this.mSpeed,
                    mPdr2baseDist: this.mPdr2baseDist,
                    mCHeadDiff: this.mCHeadDiff,
                  };
                },
              },
              {
                key: "isLast2Init",
                value: function (t, e, i, n) {
                  t &&
                    (e && ((e.x = t.x), (e.y = t.y), (e.c = 1)),
                    i && ((i.x = t.x), (i.y = t.y), (i.c = 1)),
                    n && ((n.x = t.x), (n.y = t.y), (n.c = 1)),
                    (this.lastPos = null));
                },
              },
              {
                key: "checkCallNavStart",
                value: function (t, e, i, n) {
                  var s = !0;
                  return (
                    void 0 === n ||
                      t === this.t ||
                      this.callNav ||
                      (n
                        ? (s = !1)
                        : null === n &&
                          ((this.delayCnt += 1),
                          (e && i && l.LocationUtils.distance(e, i) < 10) ||
                          this.delayCnt > 10
                            ? ((s = !0), (this.callNav = !0))
                            : (s = !1))),
                    s
                  );
                },
              },
            ]),
            e
          );
        })();
      e.ModelManager = f;
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.KalmanFilterDiffHeading = void 0);
      var s = function (t, e) {
          if (Array.isArray(t)) return t;
          if (Symbol.iterator in Object(t))
            return (function (t, e) {
              var i = [],
                n = !0,
                s = !1,
                r = void 0;
              try {
                for (
                  var o, a = t[Symbol.iterator]();
                  !(n = (o = a.next()).done) &&
                  (i.push(o.value), !e || i.length !== e);
                  n = !0
                );
              } catch (t) {
                (s = !0), (r = t);
              } finally {
                try {
                  !n && a.return && a.return();
                } finally {
                  if (s) throw r;
                }
              }
              return i;
            })(t, e);
          throw new TypeError(
            "Invalid attempt to destructure non-iterable instance",
          );
        },
        r = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        o = i(10),
        a = i(18),
        h = i(19),
        l = i(4),
        c = i(0),
        u = (function (t) {
          function e(t, i, s, r) {
            !(function (t, e) {
              if (!(t instanceof e))
                throw new TypeError("Cannot call a class as a function");
            })(this, e);
            var o = (function (t, e) {
              if (!t)
                throw new ReferenceError(
                  "this hasn't been initialised - super() hasn't been called",
                );
              return !e || ("object" != n(e) && "function" != typeof e) ? t : e;
            })(
              this,
              (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, i, s, r),
            );
            return (o.heading = null), o;
          }
          return (
            (function (t, e) {
              if ("function" != typeof e && null !== e)
                throw new TypeError(
                  "Super expression must either be null or a function, not " +
                    n(e),
                );
              (t.prototype = Object.create(e && e.prototype, {
                constructor: {
                  value: t,
                  enumerable: !1,
                  writable: !0,
                  configurable: !0,
                },
              })),
                e &&
                  (Object.setPrototypeOf
                    ? Object.setPrototypeOf(t, e)
                    : (t.__proto__ = e));
            })(e, h.KalmanFilterPDR),
            r(e, [
              {
                key: "initKFModel",
                value: function (t, e, i, n, s) {
                  var r = o.Vector.create([t.x, 0, t.y, 0]),
                    h = o.Matrix.Diagonal([900, 900, 900, 900]),
                    l = o.Matrix.create([
                      [1, 1, 0, 0],
                      [0, 1, 0, 0],
                      [0, 0, 1, 1],
                      [0, 0, 0, 1],
                    ]),
                    c = o.Vector.create([0, 0]),
                    u = o.Matrix.Diagonal([0.04, 0.04]),
                    f = o.Matrix.create([
                      [0, 0],
                      [1, 0],
                      [0, 0],
                      [0, 1],
                    ]),
                    d = o.Matrix.Diagonal([e * e, e * e]),
                    v = o.Matrix.create([
                      [0, 0],
                      [1, 0],
                      [0, 0],
                      [0, 1],
                    ]),
                    p = new a.KalmanModel(r, h, l, c, u, f, d, v),
                    y = o.Vector.create([t.x, t.y, t.x, t.y, t.x, t.y]),
                    m = o.Matrix.create([
                      [1, 0, 0, 0],
                      [0, 0, 1, 0],
                      [1, 0, 0, 0],
                      [0, 0, 1, 0],
                      [1, 0, 0, 0],
                      [0, 0, 1, 0],
                    ]),
                    g = o.Matrix.Diagonal([i, i, n, n, s, s]);
                  return [p, new a.KalmanObservation(y, m, g)];
                },
              },
              {
                key: "setVelocity",
                value: function (t) {
                  this.kalmanModel &&
                    ((this.kalmanModel.x_k.elements[1] = t.x),
                    (this.kalmanModel.x_k.elements[3] = t.y));
                },
              },
              {
                key: "calHeadingControlInput",
                value: function (t, e, i) {
                  var n = 0;
                  (!i && 0 !== i) ||
                    (!e && 0 !== e) ||
                    ((n = e - i) > Math.PI
                      ? (n -= 2 * Math.PI)
                      : n < -Math.PI && (n += 2 * Math.PI)),
                    (this.kfType !== c.KF_TYPE.DIFF_DRV &&
                      this.kfType !== c.KF_TYPE.DIFF_DRV_OUT_AND &&
                      this.kfType !== c.KF_TYPE.DIFF_DRV_OUT_IOS) ||
                      (Math.abs(n) > Math.PI / 2 && (n = 0));
                  var s = o.Vector.create([t.x, t.y]);
                  return o.Matrix.create([
                    [Math.cos(n), Math.sin(n)],
                    [-Math.sin(n), Math.cos(n)],
                  ])
                    .x(s)
                    .subtract(s);
                },
              },
              {
                key: "updateTransitionMatrix",
                value: function (t) {
                  (this.kalmanModel.F_k.elements[0][1] = t),
                    (this.kalmanModel.F_k.elements[2][3] = t),
                    (this.kalmanModel.N_k.elements[1][0] = t),
                    (this.kalmanModel.N_k.elements[3][1] = t),
                    (this.kalmanModel.N_k.elements[0][0] = (t * t) / 2),
                    (this.kalmanModel.N_k.elements[2][1] = (t * t) / 2),
                    (this.kalmanModel.B_k.elements[0][0] = t / 2),
                    (this.kalmanModel.B_k.elements[2][1] = t / 2);
                },
              },
              {
                key: "updateControlInput",
                value: function (t) {
                  void 0 === this.heading || null === this.heading
                    ? (this.heading = t)
                    : null != t &&
                      ((this.kalmanModel.u_k = this.calHeadingControlInput(
                        this.getVelocity(),
                        t,
                        this.heading,
                      )),
                      (this.heading = t));
                },
              },
              {
                key: "update",
                value: function (t, e, i, n, r, o, a) {
                  if (
                    (this.kalmanModel || this.startKF(e, i, n),
                    this.kalmanModel)
                  ) {
                    this.cnt++;
                    var h = (t - this.t) / 1e3;
                    (h = Math.max(h, 0.2)) > 2 &&
                      (console.warn("dt", h), (h = 0)),
                      (h = Math.max(h, 0.2)),
                      (this.t = t);
                    var l = this.getObrMeasurements(e, i, n),
                      c = s(l, 3),
                      u = c[0],
                      f = c[1],
                      d = c[2];
                    (u || f || d || void 0 !== r) &&
                      (this.checkReset(u, f, d, a),
                      this.updateTransitionMatrix(h),
                      this.updateControlInput(r),
                      this.updateKfModel(u, f, d, o));
                  }
                },
              },
              {
                key: "speedConstraint",
                value: function () {
                  var t;
                  t =
                    this.kfType === c.KF_TYPE.DIFF_DRV_OUT_AND ||
                    this.kfType === c.KF_TYPE.DIFF_DRV_OUT_IOS
                      ? 30
                      : 15;
                  var e = this.kalmanModel.x_k.elements[1],
                    i = this.kalmanModel.y_k.elements[3],
                    n = 1,
                    s = Math.sqrt(e * e + i * i);
                  s > t && (n = t / s),
                    (this.kalmanModel.x_k.elements[1] = n * e),
                    (this.kalmanModel.x_k.elements[3] = n * i);
                },
              },
              {
                key: "getPosition",
                value: function () {
                  if (this.kalmanModel)
                    return {
                      x: this.kalmanModel.x_k.elements[0],
                      y: this.kalmanModel.x_k.elements[2],
                    };
                },
              },
              {
                key: "getVelocity",
                value: function () {
                  if (this.kalmanModel)
                    return {
                      x: this.kalmanModel.x_k.elements[1],
                      y: this.kalmanModel.x_k.elements[3],
                    };
                },
              },
              {
                key: "tranState",
                value: function (t, e) {
                  t &&
                    e &&
                    (this.kalmanModel.x_k = o.Vector.create([
                      t.x,
                      e.x,
                      t.y,
                      e.y,
                    ]));
                },
              },
              {
                key: "getSpeed",
                value: function () {
                  return this.kalmanModel
                    ? Math.sqrt(
                        Math.pow(this.kalmanModel.x_k.elements[1], 2) +
                          Math.pow(this.kalmanModel.x_k.elements[3], 2),
                      ).toFixed(2)
                    : 0;
                },
              },
              {
                key: "getHeadingDeg",
                value: function () {
                  if (this.kalmanModel)
                    return l.Numerical.rad2deg(
                      Math.atan2(
                        this.kalmanModel.x_k.elements[1],
                        this.kalmanModel.x_k.elements[3],
                      ),
                    );
                },
              },
              {
                key: "getDspInfo",
                value: function () {
                  var t = "type:" + this.kfType;
                  return (
                    this.kalmanModel &&
                      (t +=
                        " x:" +
                        this.kalmanModel.x_k.elements[0].toFixed(1) +
                        " y:" +
                        this.kalmanModel.x_k.elements[2].toFixed(1) +
                        " vx:" +
                        this.kalmanModel.x_k.elements[1].toFixed(1) +
                        " vy:" +
                        this.kalmanModel.x_k.elements[3].toFixed(1)),
                    t
                  );
                },
              },
            ]),
            e
          );
        })();
      e.KalmanFilterDiffHeading = u;
    },
    function (i, s, r) {
      Object.defineProperty(s, "__esModule", { value: !0 }),
        (s.FingerprintsLocation = void 0);
      var o = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        a = v(r(20)),
        h = r(2),
        l = r(54),
        c = v(r(5)),
        u = v(r(9)),
        f = r(4),
        d = (r(12), r(7));
      function v(t) {
        return t && t.__esModule ? t : { default: t };
      }
      var p = r(55),
        y = (function (i) {
          function s(t) {
            !(function (t, e) {
              if (!(t instanceof e))
                throw new TypeError("Cannot call a class as a function");
            })(this, s);
            var e = (function (t, e) {
              if (!t)
                throw new ReferenceError(
                  "this hasn't been initialised - super() hasn't been called",
                );
              return !e || ("object" != n(e) && "function" != typeof e) ? t : e;
            })(this, (s.__proto__ || Object.getPrototypeOf(s)).call(this));
            return (
              t || (t = {}),
              (e.fingerprintsRadioMap = []),
              (e.fingerprintsTree = new p()),
              (e.recRssiList = []),
              (e.fpCache = {}),
              (e.fpDataMap = new Map()),
              (e.requestStack = []),
              (e.requestStackTimer = void 0),
              (e.startGetFP = !1),
              (e.recBalance = !0),
              (e.recRssiMean = -85),
              e.setParams(t),
              e
            );
          }
          return (
            (function (t, e) {
              if ("function" != typeof e && null !== e)
                throw new TypeError(
                  "Super expression must either be null or a function, not " +
                    n(e),
                );
              (t.prototype = Object.create(e && e.prototype, {
                constructor: {
                  value: t,
                  enumerable: !1,
                  writable: !0,
                  configurable: !0,
                },
              })),
                e &&
                  (Object.setPrototypeOf
                    ? Object.setPrototypeOf(t, e)
                    : (t.__proto__ = e));
            })(s, l.DEventDispatcherES6),
            o(
              s,
              [
                {
                  key: "setParams",
                  value: function (t) {
                    t || (t = {}),
                      (this.ccH = t.ccH ? t.ccH : 0.5),
                      (this.ccL = t.ccL ? t.ccL : 0.05),
                      (this.ccDistL = t.ccDistL ? t.ccDistL : 4),
                      (this.ccDistH = t.ccDistH ? t.ccDistH : 8),
                      (this.mwsL = t.mwsL ? t.mwsL : 1),
                      (this.topMWPNum = t.topMWSNum ? t.topMWSNum : 10),
                      (this.nearDistThreshold = t.nearDistThreshold
                        ? t.nearDistThreshold
                        : 25),
                      (this.lowestRecRssi = t.lowestRecRssi
                        ? t.lowestRecRssi
                        : -88),
                      (this.gaussianScale = t.gaussianScale
                        ? t.gaussianScale
                        : 1),
                      (this.recBalanceThreshold = t.recBalance
                        ? t.recBalance
                        : 4),
                      (this.matchedRateThreshold = t.matchedRateThreshold
                        ? t.matchedRateThreshold
                        : 0.3);
                  },
                },
                {
                  key: "simLoadFpMap",
                  value: function (t, e) {
                    try {
                      var i = JSON.parse(
                        u.default.readFileSync(t + "/fpCoordTransform.json"),
                      );
                      for (var n in e)
                        this.fpCache[n] = this.localToMapCoord(e[n], i);
                    } catch (t) {
                      this.fpCache = e;
                    }
                  },
                },
                {
                  key: "setFpMap",
                  value: function (t) {
                    (this.fingerprintsRadioMap = this.fpCache[t]
                      ? this.fpCache[t]
                      : []),
                      this.initFpTree();
                  },
                },
                {
                  key: "initFpTree",
                  value: function () {
                    this.fingerprintsTree = new p();
                    for (
                      var t = [], e = 0;
                      e < this.fingerprintsRadioMap.length;
                      e++
                    ) {
                      var i = this.fingerprintsRadioMap[e],
                        n = {
                          minX: i.x,
                          minY: i.y,
                          maxX: i.x,
                          maxY: i.y,
                          ind: e,
                        };
                      t.push(n);
                    }
                    this.fingerprintsTree.load(t);
                  },
                },
                {
                  key: "addFpUrlAndTransform",
                  value: function (t, e, i) {
                    this.fpDataMap.set(t, {
                      fpUrl: e,
                      promise: void 0,
                      data: void 0,
                      transform: i,
                    });
                  },
                },
                {
                  key: "getFingerprintsData",
                  value: function (t) {
                    console.log("first bt localization map: " + t),
                      (this.startGetFP = !0);
                    var e = (0, c.default)(Array.from(this.fpDataMap.keys()));
                    e.length > 0
                      ? ((this.requestStack = e.filter(function (e) {
                          return e !== t;
                        })),
                        this.requestStack.push(t),
                        this.handleRequestStack(t))
                      : console.error("No fp map urls: " + t);
                  },
                },
                {
                  key: "handleRequestStack",
                  value: function (i) {
                    var n = this;
                    clearTimeout(this.requestStackTimer),
                      (this.requestStackTimer = setTimeout(
                        e(
                          t().mark(function e() {
                            var s, r, o, a, h;
                            return t().wrap(function (t) {
                              for (;;)
                                switch ((t.prev = t.next)) {
                                  case 0:
                                    if (
                                      !(s = n.requestStack.pop()) ||
                                      s !== i
                                    ) {
                                      t.next = 9;
                                      break;
                                    }
                                    return (
                                      (r = new Date().getTime()),
                                      (t.next = 5),
                                      n.getFpDataAsync(s)
                                    );
                                  case 5:
                                    (o = t.sent)
                                      ? ((n.fpCache[s] = n.localToMapCoord(
                                          o,
                                          n.fpDataMap.get(s).transform,
                                        )),
                                        n.setFpMap(s),
                                        console.log(
                                          "successfully get first fp map: ",
                                          s,
                                          ". dt: ",
                                          new Date().getTime() - r,
                                        ))
                                      : void 0 !== o
                                        ? (n.requestStack.push(s),
                                          console.error(
                                            "failed get first fp map: ",
                                            s,
                                            ". Try Again.",
                                          ))
                                        : console.warn(
                                            "fp map:",
                                            s,
                                            "not exit",
                                          ),
                                      n.handleRequestStack(i),
                                      (t.next = 15);
                                    break;
                                  case 9:
                                    if (!s) {
                                      t.next = 15;
                                      break;
                                    }
                                    return (
                                      (a = new Date().getTime()),
                                      (t.next = 13),
                                      n.getFpDataAsync(s)
                                    );
                                  case 13:
                                    (h = t.sent) &&
                                      ((n.fpCache[s] = n.localToMapCoord(
                                        h,
                                        n.fpDataMap.get(s).transform,
                                      )),
                                      console.log(
                                        "successfully get fp map: ",
                                        s,
                                        ". dt: ",
                                        new Date().getTime() - a,
                                      )),
                                      n.handleRequestStack();
                                  case 15:
                                  case "end":
                                    return t.stop();
                                }
                            }, e);
                          }),
                        ),
                        200,
                      ));
                  },
                },
                {
                  key: "getAxios",
                  value: function () {
                    return d.LocationInterface.axios || a.default;
                  },
                },
                {
                  key: "axiosData",
                  value: function (t) {
                    var e = this;
                    return new Promise(function (i, n) {
                      e
                        .getAxios()
                        .get(t.fpUrl + "?t=" + Date.now())
                        .then(function (t) {
                          i(t);
                        })
                        .catch(n)
                        .finally(function () {
                          clearTimeout(t.timer);
                        }),
                        (t.timer = setTimeout(function () {
                          console.log("3s内没有响应"),
                            e.axiosData(t).then(i).catch(n);
                        }, 3e3));
                    });
                  },
                },
                {
                  key: "getFpDataAsync",
                  value:
                    ((r = e(
                      t().mark(function e(i) {
                        var n, s;
                        return t().wrap(
                          function (t) {
                            for (;;)
                              switch ((t.prev = t.next)) {
                                case 0:
                                  if (!(n = this.fpDataMap.get(i))) {
                                    t.next = 21;
                                    break;
                                  }
                                  if (!n.data) {
                                    t.next = 4;
                                    break;
                                  }
                                  return t.abrupt("return", n.data);
                                case 4:
                                  return (
                                    n.promise ||
                                      (n.promise = this.axiosData(n)),
                                    (t.prev = 5),
                                    (t.next = 8),
                                    n.promise
                                  );
                                case 8:
                                  (s = t.sent),
                                    (n.data = s.data),
                                    (t.next = 20);
                                  break;
                                case 12:
                                  if (
                                    ((t.prev = 12),
                                    (t.t0 = t.catch(5)),
                                    console.log("拉取报错", t.t0),
                                    !t.t0.message.startsWith("timeOut") &&
                                      -1 ===
                                        t.t0.message.indexOf("ECONNREFUSED"))
                                  ) {
                                    t.next = 18;
                                    break;
                                  }
                                  console.error(t.t0),
                                    delete n.promise,
                                    this.requestStack.unshift(i),
                                    console.log(
                                      "failed get fp map: ",
                                      i,
                                      ". Move to last.",
                                    ),
                                    (t.next = 20);
                                  break;
                                case 18:
                                  if (
                                    !t.t0.message.startsWith("Request failed")
                                  ) {
                                    t.next = 20;
                                    break;
                                  }
                                  return t.abrupt(
                                    "return",
                                    void console.log("fp map:", i, "not exit"),
                                  );
                                case 20:
                                  return t.abrupt("return", n.data || null);
                                case 21:
                                case "end":
                                  return t.stop();
                              }
                          },
                          e,
                          this,
                          [[5, 12]],
                        );
                      }),
                    )),
                    function (t) {
                      return r.apply(this, arguments);
                    }),
                },
                {
                  key: "localToMapCoord",
                  value: function (t, e) {
                    var i = this;
                    if (!e) return t;
                    if (Array.isArray(t))
                      return t.map(function (t) {
                        return i.localToMapCoord(t, e);
                      });
                    if ((!t) instanceof Object) return t;
                    var n = e.sin,
                      s = e.cos,
                      r = e.toMapDx,
                      o = e.toMapDy,
                      a = t.x,
                      h = t.y;
                    return {
                      x: a * s - h * n + r,
                      y: h * s + a * n + o,
                      z: t.z,
                      apsInf: t.apsInf,
                    };
                  },
                },
                {
                  key: "calRecApNum",
                  value: function (t) {
                    for (var e = [], i = 0; i < t.length; i++) {
                      var n = t[i];
                      e.push(Object.keys(n.apsInf).length);
                    }
                    return h.LocationUtils.standardDeviation(e);
                  },
                },
                {
                  key: "calPosByFingerprint",
                  value: function (t, e) {
                    if (
                      (this.preprocessRecRssi(t),
                      this.recRssiList.length < 2 || !this.recRssiList[0])
                    )
                      return null;
                    var i = this.selectTopMatchedWeightsProbFingerprints(e);
                    return i.length > 0
                      ? this.calPosAndConfidence(i, "cc", "dist")
                      : null;
                  },
                },
                {
                  key: "calZ",
                  value: function (t, e) {
                    for (
                      var i = new Set(), n = {}, s = -1, r = 0;
                      r < t.length;
                      r++
                    ) {
                      var o = t[r];
                      i.has(o.z) ? (n[o.z] += 1) : (i.add(o.z), (n[o.z] = 1)),
                        (s = Math.max(s, P([o.x, o.y], e)));
                    }
                    if (i.size < 2) return Array.from(i)[0];
                    for (
                      var a = {}, h = 0;
                      h < this.fingerprintsRadioMap.length;
                      h++
                    ) {
                      var l = this.fingerprintsRadioMap[h];
                      a.hasOwnProperty(l.z) || (a[l.z] = []),
                        P([l.x, l.y], e) <= s && a[l.z].push(l);
                    }
                    var c = -1,
                      u = null;
                    for (var f in n) {
                      var d = n[f] / a[f].length;
                      d > c && ((u = f), (c = d));
                    }
                    return u;
                  },
                },
                {
                  key: "calPosAndConfidence",
                  value: function (t, e, i) {
                    var n = [],
                      s = {},
                      r = Math.max(t.length, 3),
                      o = g([-100, -1], r),
                      a = g([-100, -1], r);
                    this.recBalance =
                      this.calRecApNum(t) < this.recBalanceThreshold;
                    for (var h = 0; h < t.length; h++) {
                      var l = t[h],
                        c = this.calMatchedFeatures(l);
                      n.push([l, c]),
                        (o = x(o, c[e], h, r)),
                        (a = x(a, c[i], h, r));
                    }
                    if (o[0][1] < 0 || o[0][0] <= -1) return null;
                    for (var u = [], f = 0; f < 3; f++)
                      o[f][1] > -1 &&
                        ((n[o[f][1]][1].firstRank = f), u.push(t[o[f][1]])),
                        a[f][1] > -1 && (n[a[f][1]][1].secondRank = f);
                    var d = n[o[0][1]][0],
                      v = Number(this.calZ(u, [d.x, d.y])),
                      p = this.getTopFingerprintsFeaturePairs(
                        n,
                        o.slice(0, 3),
                        v,
                      );
                    return (
                      (s.conf = this.calConfidence(p)),
                      (s.pos = this.calWeightedFingerprintsPos(n, 0, 3, o, v)),
                      s
                    );
                  },
                },
                {
                  key: "calMatchedFeatures",
                  value: function (t) {
                    for (
                      var e = 0,
                        i = [],
                        n = [],
                        r = {},
                        o =
                          this.matchedRateThreshold *
                          (this.recBalance ? 1 : 1.5),
                        a = 0;
                      a < this.recRssiList.length;
                      a++
                    ) {
                      var h = this.recRssiList[a].key,
                        l = t.apsInf[h] || null;
                      if (null !== l) {
                        var c = this.recRssiList[a].rssi,
                          u = l.median;
                        l.std, c > this.lowestRecRssi && (i.push(c), n.push(u));
                      } else e += -s.transformRssi(this.recRssiList[a].rssi);
                    }
                    return (
                      (r.cnt = n.length),
                      (r.matchedRate = i.length / Object.keys(t.apsInf).length),
                      (r.dist = e),
                      r.matchedRate < o || n.length < 5
                        ? (r.cc = -1)
                        : (r.cc = this.calCorrelationCoefficient(i, n)),
                      (r.firstRank = 10),
                      (r.secondRank = 10),
                      r
                    );
                  },
                },
                {
                  key: "calMatchedWeightsProb",
                  value: function (t) {
                    for (
                      var e = [], i = [], n = [], s = 0;
                      s < this.recRssiList.length;
                      s++
                    ) {
                      var r,
                        o = this.recRssiList[s].key;
                      null !== (r = t.apsInf[o] || null) &&
                        (n.push(this.recRssiList[s].rssi),
                        e.push(r.median),
                        i.push(r.std));
                    }
                    var a = e.length / Object.keys(t.apsInf).length;
                    return a < 0.2 || e.length < 3
                      ? 0
                      : this.calCentralizedProb(n, e, i) * a;
                  },
                },
                {
                  key: "calConfidence",
                  value: function (t) {
                    var e = 100;
                    if (0 === t.length) return e;
                    var i = s.calDivergence(t);
                    if (t.length > 0) {
                      var n = t[0];
                      e =
                        n[1].cc < this.ccL || i > this.ccDistH
                          ? 10
                          : !this.recBalance ||
                              i >
                                Math.max(0.5 * this.ccDistH, 1.5 * this.ccDistL)
                            ? 5
                            : i < this.ccDistL && n[1].cc > this.ccH
                              ? 1
                              : 2;
                    }
                    return e;
                  },
                },
                {
                  key: "calWeightedFingerprintsPos",
                  value: function (t, e, i, n, s) {
                    var r = this.getTopFingerprintsFeaturePairs(
                        t,
                        n.slice(e, e + i),
                        s,
                      ),
                      o = 0,
                      a = 0,
                      h = 0,
                      l = [];
                    if (r.length < 1) return [a, h, s];
                    for (var c = 0; c < r.length; c++) {
                      var u = r[c],
                        f = this.getWeightFromRank(c, u[1].secondRank);
                      (a += f * u[0].x), (h += f * u[0].y), (o += f), l.push(f);
                    }
                    return [(a /= o), (h /= o), s];
                  },
                },
                {
                  key: "selectTopMatchedWeightsProbFingerprints",
                  value: function (t) {
                    for (
                      var e = [],
                        i = g([-1, -1], this.topMWPNum),
                        n = this.fingerprintsTree.search({
                          minX: t.x - this.nearDistThreshold,
                          minY: t.y - this.nearDistThreshold,
                          maxX: t.x + this.nearDistThreshold,
                          maxY: t.y + this.nearDistThreshold,
                        }),
                        s = 0;
                      s < n.length;
                      s++
                    ) {
                      var r = n[s].ind,
                        o = this.fingerprintsRadioMap[r];
                      i = x(
                        i,
                        this.calMatchedWeightsProb(o),
                        r,
                        this.topMWPNum,
                      );
                    }
                    for (var a = 0; a < this.topMWPNum; a++) {
                      var h = i[a][1];
                      -1 !== h && e.push(this.fingerprintsRadioMap[h]);
                    }
                    return e;
                  },
                },
                {
                  key: "preprocessRecRssi",
                  value: function (t) {
                    (this.recRssiList = this.getRecRssiList(t)),
                      this.groupRecRssi(),
                      this.calGroupRssiMean();
                  },
                },
                {
                  key: "groupRecRssi",
                  value: function () {
                    for (
                      var t = {}, e = [], i = 0;
                      i < this.recRssiList.length;
                      i++
                    ) {
                      var n = this.recRssiList[i];
                      if (t[n.key])
                        for (var s = 0; s < e.length; s++) {
                          var r = e[s];
                          if (r.key === n.key) {
                            r.rssi.push(n.rssi);
                            break;
                          }
                        }
                      else
                        e.push({ key: n.key, rssi: [n.rssi] }), (t[n.key] = n);
                    }
                    this.recRssiList = e;
                  },
                },
                {
                  key: "calGroupRssiMean",
                  value: function () {
                    for (
                      var t = this,
                        e = [],
                        i = [],
                        n = function (n) {
                          for (
                            var s = [], r = 0;
                            r < t.recRssiList[n].rssi.length;
                            r++
                          )
                            s.push(t.recRssiList[n].rssi[r]);
                          var o =
                            s.reduce(function (t, e) {
                              return t + e;
                            }, 0) / s.length;
                          if (
                            ((s = s.map(function (t) {
                              return Math.pow(t - o, 2);
                            })),
                            o > t.lowestRecRssi)
                          ) {
                            var a =
                              s.reduce(function (t, e) {
                                return t + e;
                              }, 0) / s.length;
                            e.push({
                              key: t.recRssiList[n].key,
                              rssi: o,
                              std: Math.sqrt(a).toFixed(2),
                              num: s.length,
                            }),
                              i.push(o);
                          }
                        },
                        s = 0;
                      s < this.recRssiList.length;
                      s++
                    )
                      n(s);
                    (this.recRssiList = e.sort(function (t, e) {
                      return e.num - t.num + 0.01 * (e.rssi - t.rssi);
                    })),
                      (this.recRssiMean = m(i) / i.length);
                  },
                },
                {
                  key: "getRecRssiList",
                  value: function (t) {
                    var e = [];
                    for (var i in t) {
                      var n = String(t[i].major) + String(t[i].minor);
                      e.push({ key: n, rssi: t[i].rssi });
                    }
                    return e;
                  },
                },
                {
                  key: "getWeightFromRank",
                  value: function (t, e) {
                    if (0 === t && 0 === e) return 3;
                    var i = 1 - 0.4 * t;
                    e > 2 && (e = 3);
                    var n = Math.max(1 - 0.1 * e, 0);
                    return f.Numerical.toFixed(i * n, 2);
                  },
                },
                {
                  key: "calCentralizedProb",
                  value: function (t, e, i) {
                    for (
                      var n = 1,
                        r = t.length,
                        o = this.recRssiMean,
                        a = m(e) / e.length,
                        h = b(t, o),
                        l = b(e, a),
                        c = 0;
                      c < r;
                      c++
                    )
                      n *= 10 * s.calNormProb(h[c], l[c], Math.max(i[c], 1));
                    return Math.pow(n, 1 / r);
                  },
                },
                {
                  key: "calCentralizedDiff",
                  value: function (t, e) {
                    for (
                      var i = 0, n = t.length, r = k(t), o = k(e), a = 0;
                      a < n;
                      a++
                    )
                      i += Math.pow(
                        s.transformRssi(o[a]) - s.transformRssi(r[a]),
                        2,
                      );
                    return -Math.pow(i / n, 0.5);
                  },
                },
                {
                  key: "getTopFingerprintsFeaturePairs",
                  value: function (t, e, i) {
                    for (var n = [], s = 0; s < e.length; s++)
                      e[s][0] > -1 &&
                        e[s][1] > -1 &&
                        Number(t[e[s][1]][0].z) === i &&
                        n.push(t[e[s][1]]);
                    return n;
                  },
                },
                {
                  key: "calCorrelationCoefficient",
                  value: function (t, e) {
                    var i = m(e) / e.length,
                      n = b(t, this.recRssiMean),
                      s = b(e, i);
                    return (
                      (function (t, e) {
                        for (var i = 0, n = 0; n < t.length; n++)
                          i += t[n] * e[n];
                        return i;
                      })(n, s) /
                      (T(n) * T(s))
                    );
                  },
                },
              ],
              [
                {
                  key: "transformRssi",
                  value: function (t) {
                    return Math.pow((100 + t) / 100, Math.E);
                  },
                },
                {
                  key: "calNormProb",
                  value: function (t, e, i) {
                    return (
                      Math.exp(
                        (Math.pow(t - e, 2) / (2 * Math.pow(i, 2))) * -1,
                      ) / i
                    );
                  },
                },
                {
                  key: "calFeatureProb",
                  value: function (t) {
                    var e = t.length;
                    if (e < 1) return 0;
                    for (var i = 1, n = 0; n < t.length; n++) i *= t[n];
                    return Math.pow(i, 1 / e) * e;
                  },
                },
                {
                  key: "checkMatch",
                  value: function (t, e, i, n) {
                    return (
                      null === i && (i = 5),
                      (i = Math.max(i, 3)),
                      Math.abs(t - e) < i * n
                    );
                  },
                },
                {
                  key: "calDivergence",
                  value: function (t) {
                    for (var e = 0, i = 0, n = 0, s = 0; s < t.length - 1; s++)
                      for (var r = 1; r < t.length; r++)
                        (e += 1),
                          t[s][0].z !== t[r][0].z && (n += 1),
                          (i +=
                            Math.sqrt(
                              P([t[s][0].x, t[s][0].y], [t[r][0].x, t[r][0].y]),
                            ) +
                            3.5 * n);
                    return e > 0 ? i / e : 13;
                  },
                },
              ],
            ),
            s
          );
          var r;
        })();
      function m(t) {
        for (var e = 0, i = 0; i < t.length; i++) e += t[i];
        return e;
      }
      function g(t, e) {
        for (var i = [], n = 0; n < e; n++) i.push(t);
        return i;
      }
      function x(t, e, i, n) {
        if (e < t[n - 1][0]) return t;
        for (var s = 0; s < n; s++)
          if (t[s][0] < e) {
            t.splice(s, 0, [e, i]);
            break;
          }
        return t.slice(0, n);
      }
      function b(t, e) {
        var i = [];
        for (var n in t) i.push(t[n] - e);
        return i;
      }
      function k(t) {
        return b(t, m(t) / t.length);
      }
      function T(t) {
        var e = 0;
        for (var i in t) e += Math.pow(Number(t[i]), 2);
        return Math.sqrt(e);
      }
      function P(t, e) {
        return Math.pow(t[0] - e[0], 2) + Math.pow(t[1] - e[1], 2);
      }
      s.FingerprintsLocation = y;
    },
    function (t, e, i) {
      var n = i(1),
        s = i(21),
        r = i(38),
        o = i(11);
      function a(t) {
        var e = new r(t),
          i = s(r.prototype.request, e);
        return n.extend(i, r.prototype, e), n.extend(i, e), i;
      }
      var h = a(o);
      (h.Axios = r),
        (h.create = function (t) {
          return a(n.merge(o, t));
        }),
        (h.Cancel = i(25)),
        (h.CancelToken = i(52)),
        (h.isCancel = i(24)),
        (h.all = function (t) {
          return Promise.all(t);
        }),
        (h.spread = i(53)),
        (t.exports = h),
        (t.exports.default = h);
    },
    function (t, e) {
      t.exports = function (t) {
        return (
          null != t &&
          null != t.constructor &&
          "function" == typeof t.constructor.isBuffer &&
          t.constructor.isBuffer(t)
        );
      };
    },
    function (t, e, i) {
      var n = i(11),
        s = i(1),
        r = i(47),
        o = i(48);
      function a(t) {
        (this.defaults = t),
          (this.interceptors = { request: new r(), response: new r() });
      }
      (a.prototype.request = function (t) {
        "string" == typeof t &&
          (t = s.merge({ url: arguments[0] }, arguments[1])),
          ((t = s.merge(n, { method: "get" }, this.defaults, t)).method =
            t.method.toLowerCase());
        var e = [o, void 0],
          i = Promise.resolve(t);
        for (
          this.interceptors.request.forEach(function (t) {
            e.unshift(t.fulfilled, t.rejected);
          }),
            this.interceptors.response.forEach(function (t) {
              e.push(t.fulfilled, t.rejected);
            });
          e.length;

        )
          i = i.then(e.shift(), e.shift());
        return i;
      }),
        s.forEach(["delete", "get", "head", "options"], function (t) {
          a.prototype[t] = function (e, i) {
            return this.request(s.merge(i || {}, { method: t, url: e }));
          };
        }),
        s.forEach(["post", "put", "patch"], function (t) {
          a.prototype[t] = function (e, i, n) {
            return this.request(
              s.merge(n || {}, { method: t, url: e, data: i }),
            );
          };
        }),
        (t.exports = a);
    },
    function (t, e) {
      var i,
        n,
        s = (t.exports = {});
      function r() {
        throw new Error("setTimeout has not been defined");
      }
      function o() {
        throw new Error("clearTimeout has not been defined");
      }
      function a(t) {
        if (i === setTimeout) return setTimeout(t, 0);
        if ((i === r || !i) && setTimeout)
          return (i = setTimeout), setTimeout(t, 0);
        try {
          return i(t, 0);
        } catch (e) {
          try {
            return i.call(null, t, 0);
          } catch (e) {
            return i.call(this, t, 0);
          }
        }
      }
      !(function () {
        try {
          i = "function" == typeof setTimeout ? setTimeout : r;
        } catch (t) {
          i = r;
        }
        try {
          n = "function" == typeof clearTimeout ? clearTimeout : o;
        } catch (t) {
          n = o;
        }
      })();
      var h,
        l = [],
        c = !1,
        u = -1;
      function f() {
        c &&
          h &&
          ((c = !1), h.length ? (l = h.concat(l)) : (u = -1), l.length && d());
      }
      function d() {
        if (!c) {
          var t = a(f);
          c = !0;
          for (var e = l.length; e; ) {
            for (h = l, l = []; ++u < e; ) h && h[u].run();
            (u = -1), (e = l.length);
          }
          (h = null),
            (c = !1),
            (function (t) {
              if (n === clearTimeout) return clearTimeout(t);
              if ((n === o || !n) && clearTimeout)
                return (n = clearTimeout), clearTimeout(t);
              try {
                n(t);
              } catch (e) {
                try {
                  return n.call(null, t);
                } catch (e) {
                  return n.call(this, t);
                }
              }
            })(t);
        }
      }
      function v(t, e) {
        (this.fun = t), (this.array = e);
      }
      function p() {}
      (s.nextTick = function (t) {
        var e = new Array(arguments.length - 1);
        if (arguments.length > 1)
          for (var i = 1; i < arguments.length; i++) e[i - 1] = arguments[i];
        l.push(new v(t, e)), 1 !== l.length || c || a(d);
      }),
        (v.prototype.run = function () {
          this.fun.apply(null, this.array);
        }),
        (s.title = "browser"),
        (s.browser = !0),
        (s.env = {}),
        (s.argv = []),
        (s.version = ""),
        (s.versions = {}),
        (s.on = p),
        (s.addListener = p),
        (s.once = p),
        (s.off = p),
        (s.removeListener = p),
        (s.removeAllListeners = p),
        (s.emit = p),
        (s.prependListener = p),
        (s.prependOnceListener = p),
        (s.listeners = function (t) {
          return [];
        }),
        (s.binding = function (t) {
          throw new Error("process.binding is not supported");
        }),
        (s.cwd = function () {
          return "/";
        }),
        (s.chdir = function (t) {
          throw new Error("process.chdir is not supported");
        }),
        (s.umask = function () {
          return 0;
        });
    },
    function (t, e, i) {
      var n = i(1);
      t.exports = function (t, e) {
        n.forEach(t, function (i, n) {
          n !== e &&
            n.toUpperCase() === e.toUpperCase() &&
            ((t[e] = i), delete t[n]);
        });
      };
    },
    function (t, e, i) {
      var n = i(23);
      t.exports = function (t, e, i) {
        var s = i.config.validateStatus;
        i.status && s && !s(i.status)
          ? e(
              n(
                "Request failed with status code " + i.status,
                i.config,
                null,
                i.request,
                i,
              ),
            )
          : t(i);
      };
    },
    function (t, e, i) {
      t.exports = function (t, e, i, n, s) {
        return (
          (t.config = e),
          i && (t.code = i),
          (t.request = n),
          (t.response = s),
          t
        );
      };
    },
    function (t, e, i) {
      var n = i(1);
      function s(t) {
        return encodeURIComponent(t)
          .replace(/%40/gi, "@")
          .replace(/%3A/gi, ":")
          .replace(/%24/g, "$")
          .replace(/%2C/gi, ",")
          .replace(/%20/g, "+")
          .replace(/%5B/gi, "[")
          .replace(/%5D/gi, "]");
      }
      t.exports = function (t, e, i) {
        if (!e) return t;
        var r;
        if (i) r = i(e);
        else if (n.isURLSearchParams(e)) r = e.toString();
        else {
          var o = [];
          n.forEach(e, function (t, e) {
            null != t &&
              (n.isArray(t) ? (e += "[]") : (t = [t]),
              n.forEach(t, function (t) {
                n.isDate(t)
                  ? (t = t.toISOString())
                  : n.isObject(t) && (t = JSON.stringify(t)),
                  o.push(s(e) + "=" + s(t));
              }));
          }),
            (r = o.join("&"));
        }
        return r && (t += (-1 === t.indexOf("?") ? "?" : "&") + r), t;
      };
    },
    function (t, e, i) {
      var n = i(1),
        s = [
          "age",
          "authorization",
          "content-length",
          "content-type",
          "etag",
          "expires",
          "from",
          "host",
          "if-modified-since",
          "if-unmodified-since",
          "last-modified",
          "location",
          "max-forwards",
          "proxy-authorization",
          "referer",
          "retry-after",
          "user-agent",
        ];
      t.exports = function (t) {
        var e,
          i,
          r,
          o = {};
        return t
          ? (n.forEach(t.split("\n"), function (t) {
              if (
                ((r = t.indexOf(":")),
                (e = n.trim(t.substr(0, r)).toLowerCase()),
                (i = n.trim(t.substr(r + 1))),
                e)
              ) {
                if (o[e] && s.indexOf(e) >= 0) return;
                o[e] =
                  "set-cookie" === e
                    ? (o[e] ? o[e] : []).concat([i])
                    : o[e]
                      ? o[e] + ", " + i
                      : i;
              }
            }),
            o)
          : o;
      };
    },
    function (t, e, i) {
      var n = i(1);
      t.exports = n.isStandardBrowserEnv()
        ? (function () {
            var t,
              e = /(msie|trident)/i.test(navigator.userAgent),
              i = document.createElement("a");
            function s(t) {
              var n = t;
              return (
                e && (i.setAttribute("href", n), (n = i.href)),
                i.setAttribute("href", n),
                {
                  href: i.href,
                  protocol: i.protocol ? i.protocol.replace(/:$/, "") : "",
                  host: i.host,
                  search: i.search ? i.search.replace(/^\?/, "") : "",
                  hash: i.hash ? i.hash.replace(/^#/, "") : "",
                  hostname: i.hostname,
                  port: i.port,
                  pathname:
                    "/" === i.pathname.charAt(0)
                      ? i.pathname
                      : "/" + i.pathname,
                }
              );
            }
            return (
              (t = s(window.location.href)),
              function (e) {
                var i = n.isString(e) ? s(e) : e;
                return i.protocol === t.protocol && i.host === t.host;
              }
            );
          })()
        : function () {
            return !0;
          };
    },
    function (t, e, i) {
      var n = i(1);
      t.exports = n.isStandardBrowserEnv()
        ? {
            write: function (t, e, i, s, r, o) {
              var a = [];
              a.push(t + "=" + encodeURIComponent(e)),
                n.isNumber(i) && a.push("expires=" + new Date(i).toGMTString()),
                n.isString(s) && a.push("path=" + s),
                n.isString(r) && a.push("domain=" + r),
                !0 === o && a.push("secure"),
                (document.cookie = a.join("; "));
            },
            read: function (t) {
              var e = document.cookie.match(
                new RegExp("(^|;\\s*)(" + t + ")=([^;]*)"),
              );
              return e ? decodeURIComponent(e[3]) : null;
            },
            remove: function (t) {
              this.write(t, "", Date.now() - 864e5);
            },
          }
        : {
            write: function () {},
            read: function () {
              return null;
            },
            remove: function () {},
          };
    },
    function (t, e, i) {
      var n = i(1);
      function s() {
        this.handlers = [];
      }
      (s.prototype.use = function (t, e) {
        return (
          this.handlers.push({ fulfilled: t, rejected: e }),
          this.handlers.length - 1
        );
      }),
        (s.prototype.eject = function (t) {
          this.handlers[t] && (this.handlers[t] = null);
        }),
        (s.prototype.forEach = function (t) {
          n.forEach(this.handlers, function (e) {
            null !== e && t(e);
          });
        }),
        (t.exports = s);
    },
    function (t, e, i) {
      var n = i(1),
        s = i(49),
        r = i(24),
        o = i(11),
        a = i(50),
        h = i(51);
      function l(t) {
        t.cancelToken && t.cancelToken.throwIfRequested();
      }
      t.exports = function (t) {
        return (
          l(t),
          t.baseURL && !a(t.url) && (t.url = h(t.baseURL, t.url)),
          (t.headers = t.headers || {}),
          (t.data = s(t.data, t.headers, t.transformRequest)),
          (t.headers = n.merge(
            t.headers.common || {},
            t.headers[t.method] || {},
            t.headers || {},
          )),
          n.forEach(
            ["delete", "get", "head", "post", "put", "patch", "common"],
            function (e) {
              delete t.headers[e];
            },
          ),
          (t.adapter || o.adapter)(t).then(
            function (e) {
              return (
                l(t), (e.data = s(e.data, e.headers, t.transformResponse)), e
              );
            },
            function (e) {
              return (
                r(e) ||
                  (l(t),
                  e &&
                    e.response &&
                    (e.response.data = s(
                      e.response.data,
                      e.response.headers,
                      t.transformResponse,
                    ))),
                Promise.reject(e)
              );
            },
          )
        );
      };
    },
    function (t, e, i) {
      var n = i(1);
      t.exports = function (t, e, i) {
        return (
          n.forEach(i, function (i) {
            t = i(t, e);
          }),
          t
        );
      };
    },
    function (t, e, i) {
      t.exports = function (t) {
        return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t);
      };
    },
    function (t, e, i) {
      t.exports = function (t, e) {
        return e ? t.replace(/\/+$/, "") + "/" + e.replace(/^\/+/, "") : t;
      };
    },
    function (t, e, i) {
      var n = i(25);
      function s(t) {
        if ("function" != typeof t)
          throw new TypeError("executor must be a function.");
        var e;
        this.promise = new Promise(function (t) {
          e = t;
        });
        var i = this;
        t(function (t) {
          i.reason || ((i.reason = new n(t)), e(i.reason));
        });
      }
      (s.prototype.throwIfRequested = function () {
        if (this.reason) throw this.reason;
      }),
        (s.source = function () {
          var t;
          return {
            token: new s(function (e) {
              t = e;
            }),
            cancel: t,
          };
        }),
        (t.exports = s);
    },
    function (t, e, i) {
      t.exports = function (t) {
        return function (e) {
          return t.apply(null, e);
        };
      };
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 });
      var n = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        s = (function () {
          function t() {
            !(function (t, e) {
              if (!(t instanceof e))
                throw new TypeError("Cannot call a class as a function");
            })(this, t),
              (this.listeners = {});
          }
          return (
            n(t, [
              {
                key: "on",
                value: function (t, e) {
                  "function" == typeof e
                    ? (this.listeners[t] || (this.listeners[t] = []),
                      this.listeners[t].indexOf(e) < 0
                        ? this.listeners[t].push(e)
                        : console.warn("listener is already on!"))
                    : console.warn("listener is not function!");
                },
              },
              {
                key: "emit",
                value: function (t) {
                  var e = this.listeners[t],
                    i = Array.prototype.slice.call(arguments);
                  if ((i.shift(), e))
                    for (var n = 0, s = e.length; n < s; n++)
                      e[n].apply(this, i);
                },
              },
              {
                key: "off",
                value: function (t, e) {
                  this.listeners[t]
                    ? void 0 === e
                      ? delete this.listeners[t]
                      : (this.listeners[t] = this.listeners[t].filter(
                          function (t) {
                            return e !== t;
                          },
                        ))
                    : console.log("type not exist!");
                },
              },
              {
                key: "offAllEvents",
                value: function () {
                  this.listeners = [];
                },
              },
            ]),
            t
          );
        })();
      e.DEventDispatcherES6 = s;
    },
    function (t, e, i) {
      t.exports = (function () {
        function t(t, n, s, r, o) {
          !(function t(i, n, s, r, o) {
            for (; r > s; ) {
              if (r - s > 600) {
                var a = r - s + 1,
                  h = n - s + 1,
                  l = Math.log(a),
                  c = 0.5 * Math.exp((2 * l) / 3),
                  u =
                    0.5 *
                    Math.sqrt((l * c * (a - c)) / a) *
                    (h - a / 2 < 0 ? -1 : 1);
                t(
                  i,
                  n,
                  Math.max(s, Math.floor(n - (h * c) / a + u)),
                  Math.min(r, Math.floor(n + ((a - h) * c) / a + u)),
                  o,
                );
              }
              var f = i[n],
                d = s,
                v = r;
              for (e(i, s, n), o(i[r], f) > 0 && e(i, s, r); d < v; ) {
                for (e(i, d, v), d++, v--; o(i[d], f) < 0; ) d++;
                for (; o(i[v], f) > 0; ) v--;
              }
              0 === o(i[s], f) ? e(i, s, v) : e(i, ++v, r),
                v <= n && (s = v + 1),
                n <= v && (r = v - 1);
            }
          })(t, n, s || 0, r || t.length - 1, o || i);
        }
        function e(t, e, i) {
          var n = t[e];
          (t[e] = t[i]), (t[i] = n);
        }
        function i(t, e) {
          return t < e ? -1 : t > e ? 1 : 0;
        }
        var n = function (t) {
          void 0 === t && (t = 9),
            (this._maxEntries = Math.max(4, t)),
            (this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries))),
            this.clear();
        };
        function s(t, e, i) {
          if (!i) return e.indexOf(t);
          for (var n = 0; n < e.length; n++) if (i(t, e[n])) return n;
          return -1;
        }
        function r(t, e) {
          o(t, 0, t.children.length, e, t);
        }
        function o(t, e, i, n, s) {
          s || (s = v(null)),
            (s.minX = 1 / 0),
            (s.minY = 1 / 0),
            (s.maxX = -1 / 0),
            (s.maxY = -1 / 0);
          for (var r = e; r < i; r++) {
            var o = t.children[r];
            a(s, t.leaf ? n(o) : o);
          }
          return s;
        }
        function a(t, e) {
          return (
            (t.minX = Math.min(t.minX, e.minX)),
            (t.minY = Math.min(t.minY, e.minY)),
            (t.maxX = Math.max(t.maxX, e.maxX)),
            (t.maxY = Math.max(t.maxY, e.maxY)),
            t
          );
        }
        function h(t, e) {
          return t.minX - e.minX;
        }
        function l(t, e) {
          return t.minY - e.minY;
        }
        function c(t) {
          return (t.maxX - t.minX) * (t.maxY - t.minY);
        }
        function u(t) {
          return t.maxX - t.minX + (t.maxY - t.minY);
        }
        function f(t, e) {
          return (
            t.minX <= e.minX &&
            t.minY <= e.minY &&
            e.maxX <= t.maxX &&
            e.maxY <= t.maxY
          );
        }
        function d(t, e) {
          return (
            e.minX <= t.maxX &&
            e.minY <= t.maxY &&
            e.maxX >= t.minX &&
            e.maxY >= t.minY
          );
        }
        function v(t) {
          return {
            children: t,
            height: 1,
            leaf: !0,
            minX: 1 / 0,
            minY: 1 / 0,
            maxX: -1 / 0,
            maxY: -1 / 0,
          };
        }
        function p(e, i, n, s, r) {
          for (var o = [i, n]; o.length; )
            if (!((n = o.pop()) - (i = o.pop()) <= s)) {
              var a = i + Math.ceil((n - i) / s / 2) * s;
              t(e, a, i, n, r), o.push(i, a, a, n);
            }
        }
        return (
          (n.prototype.all = function () {
            return this._all(this.data, []);
          }),
          (n.prototype.search = function (t) {
            var e = this.data,
              i = [];
            if (!d(t, e)) return i;
            for (var n = this.toBBox, s = []; e; ) {
              for (var r = 0; r < e.children.length; r++) {
                var o = e.children[r],
                  a = e.leaf ? n(o) : o;
                d(t, a) &&
                  (e.leaf ? i.push(o) : f(t, a) ? this._all(o, i) : s.push(o));
              }
              e = s.pop();
            }
            return i;
          }),
          (n.prototype.collides = function (t) {
            var e = this.data;
            if (!d(t, e)) return !1;
            for (var i = []; e; ) {
              for (var n = 0; n < e.children.length; n++) {
                var s = e.children[n],
                  r = e.leaf ? this.toBBox(s) : s;
                if (d(t, r)) {
                  if (e.leaf || f(t, r)) return !0;
                  i.push(s);
                }
              }
              e = i.pop();
            }
            return !1;
          }),
          (n.prototype.load = function (t) {
            if (!t || !t.length) return this;
            if (t.length < this._minEntries) {
              for (var e = 0; e < t.length; e++) this.insert(t[e]);
              return this;
            }
            var i = this._build(t.slice(), 0, t.length - 1, 0);
            if (this.data.children.length)
              if (this.data.height === i.height) this._splitRoot(this.data, i);
              else {
                if (this.data.height < i.height) {
                  var n = this.data;
                  (this.data = i), (i = n);
                }
                this._insert(i, this.data.height - i.height - 1, !0);
              }
            else this.data = i;
            return this;
          }),
          (n.prototype.insert = function (t) {
            return t && this._insert(t, this.data.height - 1), this;
          }),
          (n.prototype.clear = function () {
            return (this.data = v([])), this;
          }),
          (n.prototype.remove = function (t, e) {
            if (!t) return this;
            for (
              var i, n, r, o = this.data, a = this.toBBox(t), h = [], l = [];
              o || h.length;

            ) {
              if (
                (o ||
                  ((o = h.pop()),
                  (n = h[h.length - 1]),
                  (i = l.pop()),
                  (r = !0)),
                o.leaf)
              ) {
                var c = s(t, o.children, e);
                if (-1 !== c)
                  return (
                    o.children.splice(c, 1), h.push(o), this._condense(h), this
                  );
              }
              r || o.leaf || !f(o, a)
                ? n
                  ? (i++, (o = n.children[i]), (r = !1))
                  : (o = null)
                : (h.push(o), l.push(i), (i = 0), (n = o), (o = o.children[0]));
            }
            return this;
          }),
          (n.prototype.toBBox = function (t) {
            return t;
          }),
          (n.prototype.compareMinX = function (t, e) {
            return t.minX - e.minX;
          }),
          (n.prototype.compareMinY = function (t, e) {
            return t.minY - e.minY;
          }),
          (n.prototype.toJSON = function () {
            return this.data;
          }),
          (n.prototype.fromJSON = function (t) {
            return (this.data = t), this;
          }),
          (n.prototype._all = function (t, e) {
            for (var i = []; t; )
              t.leaf
                ? e.push.apply(e, t.children)
                : i.push.apply(i, t.children),
                (t = i.pop());
            return e;
          }),
          (n.prototype._build = function (t, e, i, n) {
            var s,
              o = i - e + 1,
              a = this._maxEntries;
            if (o <= a) return r((s = v(t.slice(e, i + 1))), this.toBBox), s;
            n ||
              ((n = Math.ceil(Math.log(o) / Math.log(a))),
              (a = Math.ceil(o / Math.pow(a, n - 1)))),
              ((s = v([])).leaf = !1),
              (s.height = n);
            var h = Math.ceil(o / a),
              l = h * Math.ceil(Math.sqrt(a));
            p(t, e, i, l, this.compareMinX);
            for (var c = e; c <= i; c += l) {
              var u = Math.min(c + l - 1, i);
              p(t, c, u, h, this.compareMinY);
              for (var f = c; f <= u; f += h) {
                var d = Math.min(f + h - 1, u);
                s.children.push(this._build(t, f, d, n - 1));
              }
            }
            return r(s, this.toBBox), s;
          }),
          (n.prototype._chooseSubtree = function (t, e, i, n) {
            for (; n.push(e), !e.leaf && n.length - 1 !== i; ) {
              for (
                var s = 1 / 0, r = 1 / 0, o = void 0, a = 0;
                a < e.children.length;
                a++
              ) {
                var h = e.children[a],
                  l = c(h),
                  u =
                    ((f = t),
                    (d = h),
                    (Math.max(d.maxX, f.maxX) - Math.min(d.minX, f.minX)) *
                      (Math.max(d.maxY, f.maxY) - Math.min(d.minY, f.minY)) -
                      l);
                u < r
                  ? ((r = u), (s = l < s ? l : s), (o = h))
                  : u === r && l < s && ((s = l), (o = h));
              }
              e = o || e.children[0];
            }
            var f, d;
            return e;
          }),
          (n.prototype._insert = function (t, e, i) {
            var n = i ? t : this.toBBox(t),
              s = [],
              r = this._chooseSubtree(n, this.data, e, s);
            for (
              r.children.push(t), a(r, n);
              e >= 0 && s[e].children.length > this._maxEntries;

            )
              this._split(s, e), e--;
            this._adjustParentBBoxes(n, s, e);
          }),
          (n.prototype._split = function (t, e) {
            var i = t[e],
              n = i.children.length,
              s = this._minEntries;
            this._chooseSplitAxis(i, s, n);
            var o = this._chooseSplitIndex(i, s, n),
              a = v(i.children.splice(o, i.children.length - o));
            (a.height = i.height),
              (a.leaf = i.leaf),
              r(i, this.toBBox),
              r(a, this.toBBox),
              e ? t[e - 1].children.push(a) : this._splitRoot(i, a);
          }),
          (n.prototype._splitRoot = function (t, e) {
            (this.data = v([t, e])),
              (this.data.height = t.height + 1),
              (this.data.leaf = !1),
              r(this.data, this.toBBox);
          }),
          (n.prototype._chooseSplitIndex = function (t, e, i) {
            for (
              var n, s, r, a, h, l, u, f = 1 / 0, d = 1 / 0, v = e;
              v <= i - e;
              v++
            ) {
              var p = o(t, 0, v, this.toBBox),
                y = o(t, v, i, this.toBBox),
                m =
                  ((s = p),
                  (r = y),
                  void 0,
                  void 0,
                  void 0,
                  void 0,
                  (a = Math.max(s.minX, r.minX)),
                  (h = Math.max(s.minY, r.minY)),
                  (l = Math.min(s.maxX, r.maxX)),
                  (u = Math.min(s.maxY, r.maxY)),
                  Math.max(0, l - a) * Math.max(0, u - h)),
                g = c(p) + c(y);
              m < f
                ? ((f = m), (n = v), (d = g < d ? g : d))
                : m === f && g < d && ((d = g), (n = v));
            }
            return n || i - e;
          }),
          (n.prototype._chooseSplitAxis = function (t, e, i) {
            var n = t.leaf ? this.compareMinX : h,
              s = t.leaf ? this.compareMinY : l;
            this._allDistMargin(t, e, i, n) < this._allDistMargin(t, e, i, s) &&
              t.children.sort(n);
          }),
          (n.prototype._allDistMargin = function (t, e, i, n) {
            t.children.sort(n);
            for (
              var s = this.toBBox,
                r = o(t, 0, e, s),
                h = o(t, i - e, i, s),
                l = u(r) + u(h),
                c = e;
              c < i - e;
              c++
            ) {
              var f = t.children[c];
              a(r, t.leaf ? s(f) : f), (l += u(r));
            }
            for (var d = i - e - 1; d >= e; d--) {
              var v = t.children[d];
              a(h, t.leaf ? s(v) : v), (l += u(h));
            }
            return l;
          }),
          (n.prototype._adjustParentBBoxes = function (t, e, i) {
            for (var n = i; n >= 0; n--) a(e[n], t);
          }),
          (n.prototype._condense = function (t) {
            for (var e = t.length - 1, i = void 0; e >= 0; e--)
              0 === t[e].children.length
                ? e > 0
                  ? (i = t[e - 1].children).splice(i.indexOf(t[e]), 1)
                  : this.clear()
                : r(t[e], this.toBBox);
          }),
          n
        );
      })();
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 });
      var n = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        s = (function () {
          function t() {
            !(function (t, e) {
              if (!(t instanceof e))
                throw new TypeError("Cannot call a class as a function");
            })(this, t);
          }
          return (
            n(t, null, [
              {
                key: "draw",
                value: function (t, e, i, n, s) {
                  "undefined" != typeof seeklaneEngine &&
                    seeklaneEngine.pd &&
                    seeklaneEngine.pd.drawCb &&
                    seeklaneEngine.pd.drawCb({
                      markId: t,
                      position: e,
                      color: i,
                      text: n,
                      floorFrom: s,
                    });
                },
              },
              {
                key: "clear",
                value: function (t) {
                  this.draw({ markId: t, position: null });
                },
              },
              {
                key: "drawFingerPrint",
                value: function (t, e, i, n) {
                  n
                    ? this.draw(
                        "fp",
                        { x: t, y: e },
                        "#d900ff",
                        i + "",
                        "mypos",
                      )
                    : this.draw(
                        "fp",
                        { x: t, y: e },
                        "#00ff33",
                        i + "",
                        "mypos",
                      );
                },
              },
            ]),
            t
          );
        })();
      (s.drawCb = void 0), (e.PointDrawer = s);
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.HmmDataLoader = void 0);
      var n,
        s = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        r = (n = i(5)) && n.__esModule ? n : { default: n },
        o = (function () {
          function t() {
            !(function (t, e) {
              if (!(t instanceof e))
                throw new TypeError("Cannot call a class as a function");
            })(this, t),
              (this.currIndexing = -1e4),
              (this.connection = {}),
              (this.roads = { roads: {}, turns: {} }),
              (this.outside = void 0),
              (this.pendingEntries = []),
              (this.outsideVertex = {}),
              (this.inValidEntries = []);
          }
          return (
            s(t, [
              {
                key: "loadData",
                value: function (t, e, i, n, s) {
                  var r =
                    arguments.length > 5 && void 0 !== arguments[5]
                      ? arguments[5]
                      : "walk";
                  void 0 === this.outside &&
                    ((this.outside = i), (this.outsideVertex = t)),
                    (this.currIndexing += 1e4),
                    void 0 !== e &&
                      (this.addRoads(e, s, i),
                      this.addVertex(t, s, i),
                      this.addTurns(e.turns),
                      0 !== this.currIndexing &&
                        this.loadEntries(n, r, t, s, i));
                },
              },
              {
                key: "addTurns",
                value: function (t) {
                  for (var e in t) {
                    this.roads.turns[parseInt(e) + this.currIndexing] = {
                      inf: [],
                      fromNe: [],
                    };
                    var i = !0,
                      n = !1,
                      s = void 0;
                    try {
                      for (
                        var r, o = t[e].inf[Symbol.iterator]();
                        !(i = (r = o.next()).done);
                        i = !0
                      ) {
                        var a = r.value;
                        this.roads.turns[
                          parseInt(e) + this.currIndexing
                        ].inf.push([
                          a[0] + this.currIndexing,
                          a[1] + this.currIndexing,
                        ]);
                      }
                    } catch (t) {
                      (n = !0), (s = t);
                    } finally {
                      try {
                        !i && o.return && o.return();
                      } finally {
                        if (n) throw s;
                      }
                    }
                    var h = !0,
                      l = !1,
                      c = void 0;
                    try {
                      for (
                        var u, f = t[e].fromNe[Symbol.iterator]();
                        !(h = (u = f.next()).done);
                        h = !0
                      ) {
                        var d = u.value;
                        this.roads.turns[
                          parseInt(e) + this.currIndexing
                        ].fromNe.push(d + this.currIndexing);
                      }
                    } catch (t) {
                      (l = !0), (c = t);
                    } finally {
                      try {
                        !h && f.return && f.return();
                      } finally {
                        if (l) throw c;
                      }
                    }
                  }
                },
              },
              {
                key: "pointDis",
                value: function (t, e) {
                  return Math.sqrt(
                    (t.x - e.x) * (t.x - e.x) + (t.y - e.y) * (t.y - e.y),
                  );
                },
              },
              {
                key: "matchPendingEntry",
                value: function (t, e, i, n) {
                  for (
                    var s = 3, r = -1, o = 0;
                    o < this.pendingEntries.length;
                    o++
                  )
                    e === this.pendingEntries[o].type &&
                      this.pointDis(this.pendingEntries[o], t) < s &&
                      this.pendingEntries[o].z === t.z &&
                      this.pendingEntries[o].index -
                        (this.pendingEntries[o].index % 1e4) !=
                        i - (i % 1e4) &&
                      ((s = this.pointDis(this.pendingEntries[o], t)), (r = o));
                  return (
                    -1 !== r &&
                    (this.matchPoints(this.pendingEntries[r].index, i, n, e),
                    this.pendingEntries.splice(r, 1),
                    !0)
                  );
                },
              },
              {
                key: "matchOutside",
                value: function (t, e, i, n) {
                  var s = 3,
                    r = -1;
                  for (var o in this.outsideVertex)
                    this.pointDis(this.connection[o], t) < s &&
                      this.connection[o].re === t.z &&
                      ((s = this.pointDis(this.connection[o], t)),
                      (r = parseInt(o)));
                  return -1 !== r && (this.matchPoints(r, i, n, e), !0);
                },
              },
              {
                key: "addToIntersection",
                value: function (t) {
                  var e = !0,
                    i = !1,
                    n = void 0;
                  try {
                    for (
                      var s,
                        r =
                          this.roads.roads[this.connection[t].re][
                            Symbol.iterator
                          ]();
                      !(e = (s = r.next()).done);
                      e = !0
                    ) {
                      var o = s.value;
                      if (
                        o.vertexes.length > 2 &&
                        o.vertexes.indexOf(t) > 0 &&
                        o.intersections.indexOf(t) < 0
                      ) {
                        o.intersections.push(t);
                        break;
                      }
                      if (
                        o.vertexes[0].constructor === Array &&
                        o.vertexes[0].indexOf(t) > 0 &&
                        o.intersections.indexOf(t) < 0
                      ) {
                        o.intersections.push(t);
                        break;
                      }
                    }
                  } catch (t) {
                    (i = !0), (n = t);
                  } finally {
                    try {
                      !e && r.return && r.return();
                    } finally {
                      if (i) throw n;
                    }
                  }
                },
              },
              {
                key: "matchPoints",
                value: function (t, e, i) {
                  var n =
                    arguments.length > 3 && void 0 !== arguments[3]
                      ? arguments[3]
                      : 0;
                  this.connection[t].ne || (this.connection[t].ne = []),
                    this.connection[e].ne || (this.connection[e].ne = []),
                    this.connection[t].ne.push(e),
                    this.connection[e].ne.push(t),
                    this.connection[e].re !== this.connection[t].re
                      ? ((this.connection[e].type = [n]),
                        (this.connection[t].type = [n]))
                      : 0 !== n &&
                        (this.connection[e].special
                          ? (this.connection[e].special.ne.push(t),
                            this.connection[e].special.type.push([n]))
                          : ((this.connection[e].special = {}),
                            (this.connection[e].special.ne = [t]),
                            (this.connection[e].special.type = [[n]])),
                        this.connection[t].special
                          ? (this.connection[t].special.ne.push(e),
                            this.connection[t].special.type.push([n]))
                          : ((this.connection[t].special = {}),
                            (this.connection[t].special.ne = [e]),
                            (this.connection[t].special.type = [[n]]))),
                    this.addToIntersection(t),
                    this.addToIntersection(e),
                    this.connection[t].re === this.connection[e].re &&
                      this.roads.roads[this.connection[e].re].push({
                        one_way: !1,
                        vertexes: [t, e],
                        factor: 1,
                        buildingCode: i,
                      });
                },
              },
              {
                key: "loadEntries",
                value: function (t, e, i, n, s) {
                  for (var r in t)
                    if (t[r].entries) {
                      var o = !0,
                        a = !1,
                        h = void 0;
                      try {
                        for (
                          var l, c = t[r].entries[Symbol.iterator]();
                          !(o = (l = c.next()).done);
                          o = !0
                        ) {
                          var u = l.value;
                          if (
                            void 0 === u.mode ||
                            (u.mode && u.mode.indexOf(e) >= 0) ||
                            (u.mode && u.mode.length > 1 && "walk" === e) ||
                            (u.mode &&
                              1 === u.mode.length &&
                              "walk" === e &&
                              "drive" !== u.mode[0] &&
                              "car" !== u.mode[0]) ||
                            (u.mode &&
                              u.mode.indexOf("drive") >= 0 &&
                              "car" === e)
                          ) {
                            var f = this.findClosestIndexInside(u, i, n, s);
                            if ("0" === f) {
                              this.inValidEntries.push([u, s]);
                              continue;
                            }
                            var d = 0;
                            switch (u.type) {
                              case "lift":
                                d = 3;
                                break;
                              case "slope":
                                d = 1;
                                break;
                              case "stairs":
                                d = 6;
                                break;
                              case "escalator":
                                d = 1024;
                                break;
                              default:
                                d = 0;
                            }
                            if (this.matchPendingEntry(u.out, d, f, s))
                              continue;
                            if (this.matchOutside(u.out, d, f, s)) continue;
                            var v = {
                              x: u.in.x,
                              y: u.in.y,
                              z: u.in.z,
                              index: f,
                              type: d,
                            };
                            this.pendingEntries.push(v);
                          }
                        }
                      } catch (t) {
                        (a = !0), (h = t);
                      } finally {
                        try {
                          !o && c.return && c.return();
                        } finally {
                          if (a) throw h;
                        }
                      }
                    }
                },
              },
              {
                key: "findClosestIndexInside",
                value: function (t, e, i, n) {
                  var s = 5,
                    r = "0";
                  for (var o in e)
                    i.regionMapEncode(e[o].re, n) === t.in.z &&
                      Math.sqrt(
                        Math.pow(e[o].x - t.in.x, 2) +
                          Math.pow(e[o].y - t.in.y, 2),
                      ) < s &&
                      ((r = parseInt(o) + this.currIndexing),
                      (s = Math.sqrt(
                        Math.pow(e[o].x - t.in.x, 2) +
                          Math.pow(e[o].y - t.in.y, 2),
                      )));
                  return r;
                },
              },
              {
                key: "addVertex",
                value: function (t, e, i) {
                  for (var n in t) {
                    var s = this.currIndexing + parseInt(n);
                    this.connection[s] = (0, r.default)(t[n]);
                    var o = this.connection[s].ne;
                    if (o) {
                      for (var a = 0; a < o.length; a++)
                        o[a] += this.currIndexing;
                      this.connection[s].re = e.regionMapEncode(t[n].re, i);
                    } else
                      this.connection[s].re = e.regionMapEncode(t[n].re, i);
                  }
                },
              },
              {
                key: "addRoads",
                value: function (t, e, i) {
                  for (var n in t.roads)
                    for (var s in (this.roads.roads.hasOwnProperty(
                      e.regionMapEncode(n, i),
                    ) || (this.roads.roads[e.regionMapEncode(n, i)] = []),
                    t.roads[n])) {
                      var o = (0, r.default)(t.roads[n][s]);
                      o.buildingCode = i;
                      for (var a = 0; a < o.vertexes.length; a++)
                        if (isNaN(o.vertexes[a]))
                          for (var h = 0; h < o.vertexes[a].length; h++)
                            o.vertexes[a][h] += this.currIndexing;
                        else o.vertexes[a] += this.currIndexing;
                      if (void 0 !== o.intersections)
                        for (var l = 0; l < o.intersections.length; l++)
                          o.intersections[l] += this.currIndexing;
                      this.roads.roads[e.regionMapEncode(n, i)].push(o);
                    }
                },
              },
            ]),
            t
          );
        })();
      e.HmmDataLoader = o;
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.FloorMapper = void 0);
      var n,
        s = (function () {
          function t(t, e) {
            for (var i = 0; i < e.length; i++) {
              var n = e[i];
              (n.enumerable = n.enumerable || !1),
                (n.configurable = !0),
                "value" in n && (n.writable = !0),
                Object.defineProperty(t, n.key, n);
            }
          }
          return function (e, i, n) {
            return i && t(e.prototype, i), n && t(e, n), e;
          };
        })(),
        r = i(13),
        o = (n = i(5)) && n.__esModule ? n : { default: n },
        a = (function () {
          function t() {
            var e =
                arguments.length > 0 && void 0 !== arguments[0]
                  ? arguments[0]
                  : {},
              i =
                arguments.length > 1 && void 0 !== arguments[1]
                  ? arguments[1]
                  : {};
            !(function (t, e) {
              if (!(t instanceof e))
                throw new TypeError("Cannot call a class as a function");
            })(this, t),
              (this.floor2ZMaps = e),
              (this.z2FloorMaps = i),
              (this.currIndexing = -1e4),
              (this.mapIndex = {}),
              this.createBasicMap();
          }
          return (
            s(t, [
              {
                key: "createBasicMap",
                value: function () {
                  for (var t in ((this.height2FloorMap = {}),
                  (this.floor2HeightMap = {}),
                  r.HEIGHT))
                    (this.height2FloorMap[r.HEIGHT[t]] = r.FLOOR[t]),
                      (this.floor2HeightMap[r.FLOOR[t]] = r.HEIGHT[t]);
                },
              },
              {
                key: "regionMapDecode",
                value: function (t, e) {
                  return this.mapZ2Region(t, e);
                },
              },
              {
                key: "mapZ2Region",
                value: function (t, e) {
                  if (this.z2FloorMaps[t]) {
                    var i = this.z2FloorMaps[t][e];
                    return void 0 === i
                      ? (console.error("z=", e, " not in building=", t), e)
                      : i;
                  }
                  return e;
                },
              },
              {
                key: "regionMapEncode",
                value: function (t, e) {
                  return this.mapRegion2Z(e, t);
                },
              },
              {
                key: "mapRegion2Z",
                value: function (t, e) {
                  if (this.floor2ZMaps[t]) {
                    var i = this.floor2ZMaps[t][e];
                    return void 0 === i
                      ? (-1e4 !== e &&
                          console.error("floor=", e, "not in building=", t),
                        e)
                      : i;
                  }
                  return e;
                },
              },
              {
                key: "getMapIndex",
                value: function () {
                  return this.mapIndex;
                },
              },
              {
                key: "loadMapping",
                value: function (t, e) {
                  if (
                    ((this.currIndexing += 1e4),
                    (this.mapIndex[e] = this.currIndexing),
                    void 0 !== t[0].z)
                  ) {
                    var i = (0, o.default)(this.floor2HeightMap),
                      n = (0, o.default)(this.height2FloorMap),
                      s = !0,
                      r = !1,
                      a = void 0;
                    try {
                      for (
                        var h, l = t[Symbol.iterator]();
                        !(s = (h = l.next()).done);
                        s = !0
                      ) {
                        var c = h.value;
                        (i[c.region] = c.z), (n[c.z] = c.region);
                      }
                    } catch (t) {
                      (r = !0), (a = t);
                    } finally {
                      try {
                        !s && l.return && l.return();
                      } finally {
                        if (r) throw a;
                      }
                    }
                    (this.floor2ZMaps[e] = i), (this.z2FloorMaps[e] = n);
                  }
                },
              },
            ]),
            t
          );
        })();
      e.FloorMapper = a;
    },
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 });
      var s =
        "function" == typeof Symbol && "symbol" == n(Symbol.iterator)
          ? function (t) {
              return n(t);
            }
          : function (t) {
              return t &&
                "function" == typeof Symbol &&
                t.constructor === Symbol &&
                t !== Symbol.prototype
                ? "symbol"
                : n(t);
            };
      function r(t) {
        var e = void 0;
        if ("object" === (void 0 === t ? "undefined" : s(t)))
          if (Array.isArray(t)) for (var i in ((e = []), t)) e[i] = r(t[i]);
          else if (null === t) e = null;
          else if (t.constructor === RegExp) e = t;
          else for (var n in ((e = {}), t)) e[n] = r(t[n]);
        else e = t;
        return e;
      }
      function o(t, e) {
        var i = a(t),
          n = a(e);
        if (!i || !n) return -1;
        var s = Math.sqrt(
          Math.pow(i.x - n.x, 2) +
            Math.pow(i.y - n.y, 2) +
            Math.pow(i.z - n.z, 2),
        );
        return Math.round(100 * s) / 100;
      }
      function a(t) {
        var e = {};
        if (Array.isArray(t))
          2 === t.length && (e = { x: t[0], y: t[1], z: 0 }),
            3 === t.length && (e = { x: t[0], y: t[1], z: t[2] });
        else {
          if (!t.hasOwnProperty("x") || !t.hasOwnProperty("y")) return null;
          (e = { x: t.x, y: t.y, z: t.z }), t.hasOwnProperty("z") || (e.z = 0);
        }
        return e;
      }
      function h(t, e, i) {
        "z" in t || console.warn("point should have z property");
        var n = a(t),
          s = a(e),
          r = a(i),
          h =
            (n.x - s.x) * (r.x - s.x) +
            (n.y - s.y) * (r.y - s.y) +
            (n.z - s.z) * (r.z - s.z);
        if (h <= 0) return [o(n, s), s, 0];
        var l = Math.pow(o(s, r), 2);
        if (h >= l) return [o(n, r), r, 2];
        var c = h / l,
          u = {
            x: s.x + c * (r.x - s.x),
            y: s.y + c * (r.y - s.y),
            z: s.z + c * (r.z - s.z),
          };
        return [o(n, u), u, 1];
      }
      function l(t, e, i) {
        var n = (function (t, e) {
            var i = t;
            if (!Array.isArray(t)) return null;
            if (Array.isArray(t[0]))
              i = (function (t, e) {
                void 0 === e && (e = 0);
                var i = [];
                return (
                  t.forEach(function (t) {
                    i.push({ x: t[0], y: t[1], z: e });
                  }),
                  i
                );
              })(t);
            else if (t[0].hasOwnProperty("x"));
            else {
              if (!e) return null;
              i = (function (t, e) {
                var i = [];
                return (
                  t.forEach(function (t) {
                    i.push(e[t]);
                  }),
                  i
                );
              })(t, e);
            }
            return (
              i[0].x === i[i.length - 1].x &&
                i[0].y === i[i.length - 1].y &&
                i.shift(),
              i
            );
          })(e, i),
          s = a(t);
        if (!s || !n) return !1;
        for (var r = !1, o = 0, l = n.length - 1; o < n.length; l = o++) {
          var c = n[o].x,
            u = n[o].y,
            f = n[l].x,
            d = n[l].y;
          if (h(s, n[o], n[l])[0] < 1e-8) return !0;
          u > s.y != d > s.y &&
            s.x < ((f - c) * (s.y - u)) / (d - u) + c &&
            (r = !r);
        }
        return r;
      }
      function c(t, e, i, n, s, r, o, a) {
        (this.x = t),
          (this.y = e),
          (this.z = i),
          (this.re = i),
          (this.ne = n),
          (this.type = s),
          (this.cost = r),
          (this.factor = void 0 === o ? {} : o),
          (this.special = a);
      }
      function u(t) {
        var e = r(t);
        for (var i in (this.loadGates(e),
        (this.newConnectionSet = new Set()),
        (this.newCarConnectionSet = new Set()),
        (this.connections = {}),
        (this.drivingConnection = {}),
        (this.roads = {}),
        (this.drivingRoads = {}),
        (this.turns = {}),
        (this.carTurns = {}),
        (this.modeClass = void 0),
        e.parameters &&
          e.parameters.extra &&
          e.parameters.extra.modeClass &&
          this.loadModeClass(e.parameters.extra.modeClass),
        e.roads))
          for (var n in e.roads[i]) this.getAllPoints(e.roads[i][n]);
        this.V2toV1(e),
          (this.res = {
            connection: this.connections,
            roads: { roads: this.roads, turns: this.turns },
            drivingConnection: this.drivingConnection,
            drivingRoads: { roads: this.drivingRoads, turns: this.carTurns },
          });
      }
      (c.prototype.constructor = {
        constructor: c,
        isSameRegionWithRoad: function (t, e) {
          var i = t.intersections[0];
          return this.z === e[i].z;
        },
      }),
        (u.prototype = {
          constructor: u,
          V2toV1: function (t) {
            for (var e in t.points) {
              if (
                this.newConnectionSet.has(parseInt(e)) &&
                ((this.connections[e] = {
                  x: Math.round(1e3 * t.points[e].x) / 1e3,
                  y: Math.round(1e3 * t.points[e].y) / 1e3,
                  re: t.points[e].region,
                  ne: [],
                }),
                t.points[e].turns && t.points[e].turns.length > 0)
              )
                for (
                  var i = t.points[e].region, n = 0;
                  n < t.points[e].in.length;
                  n++
                )
                  for (var s = 0; s < t.points[e].out.length; s++)
                    if ("infinity" === t.points[e].turns[n][s]) {
                      var r = t.roads[i][t.points[e].in[n]],
                        o = t.roads[i][t.points[e].out[s]];
                      if (
                        "line" === r.geometry &&
                        "line" === o.geometry &&
                        this.checkModeClass(r, "walk") &&
                        this.checkModeClass(o, "walk")
                      ) {
                        var a, h;
                        (a =
                          r.vertexes[0] === parseInt(e)
                            ? r.vertexes[1]
                            : r.vertexes[0]),
                          (h =
                            o.vertexes[0] === parseInt(e)
                              ? o.vertexes[1]
                              : o.vertexes[0]),
                          this.turns[e] ||
                            (this.turns[e] = { inf: [], fromNe: [] }),
                          this.turns[e].inf.push([a, h]);
                      }
                    }
              if (
                this.newCarConnectionSet.has(parseInt(e)) &&
                ((this.drivingConnection[e] = {
                  x: Math.round(1e3 * t.points[e].x) / 1e3,
                  y: Math.round(1e3 * t.points[e].y) / 1e3,
                  re: t.points[e].region,
                  ne: [],
                }),
                t.points[e].turns && t.points[e].turns.length > 0)
              )
                for (
                  var l = t.points[e].region, c = 0;
                  c < t.points[e].in.length;
                  c++
                )
                  for (var u = 0; u < t.points[e].out.length; u++)
                    if ("infinity" === t.points[e].turns[c][u]) {
                      var f = t.roads[l][t.points[e].in[c]],
                        d = t.roads[l][t.points[e].out[u]];
                      if (
                        "line" === f.geometry &&
                        "line" === d.geometry &&
                        this.checkModeClass(f, "car") &&
                        this.checkModeClass(d, "car")
                      ) {
                        var v, p;
                        (v =
                          f.vertexes[0] === parseInt(e)
                            ? f.vertexes[1]
                            : f.vertexes[0]),
                          (p =
                            d.vertexes[0] === parseInt(e)
                              ? d.vertexes[1]
                              : d.vertexes[0]),
                          this.carTurns[e] ||
                            (this.carTurns[e] = { inf: [], fromNe: [] }),
                          this.carTurns[e].inf.push([v, p]);
                      }
                    }
            }
            for (var y in t.roads)
              for (var m in ("-10000" !== y && (this.roads[y] = []),
              t.roads[y])) {
                var g = t.roads[y][m];
                if (
                  (this.v2RoadToV1(g, y),
                  ("polygon" === g.geometry ||
                    "multi-polygon" === g.geometry) &&
                    (!0 === g.enable || void 0 === g.enable) &&
                    t.polyConnection &&
                    t.polyConnection[m])
                )
                  for (var x in t.polyConnection[m])
                    this.connections[parseInt(x)].ne = this.connections[
                      x
                    ].ne.concat(t.polyConnection[m][x]);
              }
          },
          loadGates: function (t) {
            var e = 0,
              i = 0;
            for (var n in t.roads)
              for (var s in t.roads[n]) parseInt(s) > i && (i = parseInt(s));
            for (var o in t.points) parseInt(o) > e && (e = parseInt(o));
            if (((e += 1), (i += 1), (this.gateRoads = {}), t.gates))
              for (var a in t.gates) {
                if (!t.gates[a].region)
                  return void console.log(
                    "门数据格式更新, 门未生效，请重新保存，发布！",
                  );
                if (void 0 !== t.gates[a].close && !1 !== t.gates[a].close)
                  if (this.gateRoads[t.gates[a].roadId]) {
                    var h = 1 / 0,
                      l = -1,
                      c = !0,
                      u = !1,
                      f = void 0;
                    try {
                      for (
                        var d,
                          v =
                            this.gateRoads[t.gates[a].roadId][
                              Symbol.iterator
                            ]();
                        !(c = (d = v.next()).done);
                        c = !0
                      ) {
                        var p = d.value,
                          y = [t.gates[a].x, t.gates[a].y],
                          m = [
                            t.points[t.roads[t.gates[a].region][p].vertexes[0]]
                              .x,
                            t.points[t.roads[t.gates[a].region][p].vertexes[0]]
                              .y,
                          ],
                          g = [
                            t.points[t.roads[t.gates[a].region][p].vertexes[1]]
                              .x,
                            t.points[t.roads[t.gates[a].region][p].vertexes[1]]
                              .y,
                          ],
                          x = this.projectPoint2LineDistance(y, m, g);
                        x < h && ((h = x), (l = p));
                      }
                    } catch (t) {
                      (u = !0), (f = t);
                    } finally {
                      try {
                        !c && v.return && v.return();
                      } finally {
                        if (u) throw f;
                      }
                    }
                    if (-1 !== l) {
                      var b = r(t.roads[t.gates[a].region][l]),
                        k = r(t.roads[t.gates[a].region][l]);
                      delete t.roads[t.gates[a].region][l],
                        (b.vertexes[1] = e),
                        (t.points[e] = {
                          x: t.gates[a].x,
                          y: t.gates[a].y,
                          region: t.gates[a].region,
                        }),
                        (e += 1),
                        (k.vertexes[0] = e),
                        (t.points[e] = {
                          x: t.gates[a].x,
                          y: t.gates[a].y,
                          region: t.gates[a].region,
                        }),
                        (e += 1),
                        (t.roads[t.gates[a].region][i] = b),
                        this.gateRoads[t.gates[a].roadId].push(i),
                        (i += 1),
                        (t.roads[t.gates[a].region][i] = k),
                        this.gateRoads[t.gates[a].roadId].push(i),
                        (i += 1);
                      var T = this.gateRoads[t.gates[a].roadId].indexOf(l);
                      this.gateRoads[t.gates[a].roadId].splice(T, 1);
                    }
                  } else if (
                    t.roads[t.gates[a].region][t.gates[a].roadId] &&
                    !1 !== t.roads[t.gates[a].region][t.gates[a].roadId].enable
                  ) {
                    var P = r(t.roads[t.gates[a].region][t.gates[a].roadId]),
                      M = r(t.roads[t.gates[a].region][t.gates[a].roadId]);
                    delete t.roads[t.gates[a].region][t.gates[a].roadId],
                      (P.vertexes[1] = e),
                      (t.points[e] = {
                        x: t.gates[a].x,
                        y: t.gates[a].y,
                        region: t.gates[a].region,
                      }),
                      (e += 1),
                      (M.vertexes[0] = e),
                      (t.points[e] = {
                        x: t.gates[a].x,
                        y: t.gates[a].y,
                        region: t.gates[a].region,
                      }),
                      (e += 1),
                      (t.roads[t.gates[a].region][i] = P),
                      (i += 1),
                      (t.roads[t.gates[a].region][i] = M),
                      (i += 1),
                      (this.gateRoads[t.gates[a].roadId] = [i - 2, i - 1]);
                  }
              }
          },
          isNeighborPolygon: function (t, e, i) {
            return this.isValidLine(
              this.connections[t],
              this.connections[e],
              this.connections,
              i,
            );
          },
          isValidLine: function (t, e, i, n) {
            var s = function (t, e) {
                return function (i, n) {
                  if (t.x - e.x == 0 && t.y - e.y == 0) {
                    var s = 0.01 * (n - e.y);
                    return Math.abs(s) > 0.01 ? s : 0;
                  }
                  var r = (n - e.y) * (t.x - e.x) - (i - e.x) * (t.y - e.y);
                  return Math.abs(r) > 0.01 ? r : 0;
                };
              },
              r = function (t, e, i, n) {
                var r = s(i, n);
                if (
                  Math.abs(r(t.x, t.y)) < 1e-8 &&
                  Math.abs(r(e.x, e.y)) < 1e-8
                ) {
                  var o = void 0,
                    a = void 0,
                    h = void 0,
                    l = void 0,
                    c = void 0;
                  Math.abs(t.x - e.x) > Math.abs(t.y - e.y)
                    ? ((o = Math.min(t.x, e.x)),
                      (a = Math.max(t.x, e.x)),
                      (h = Math.min(i.x, n.x)),
                      (l = Math.max(i.x, n.x)),
                      (c = Math.abs(t.x - e.x)))
                    : ((o = Math.min(t.y, e.y)),
                      (a = Math.max(t.y, e.y)),
                      (h = Math.min(i.y, n.y)),
                      (l = Math.max(i.y, n.y)),
                      (c = Math.abs(t.y - e.y)));
                  var u = Math.max(o, h),
                    f = Math.min(a, l);
                  return u >= f ? 3 : f - u >= c - 0.001 ? 1 : 2;
                }
                return 3;
              };
            for (var a in n)
              for (var h = n[a].length, u = 0, f = h - 1; u < h; f = u++)
                switch (r(t, e, i[n[a][u]], i[n[a][f]])) {
                  case 1:
                    return !0;
                  case 2:
                    return !1;
                }
            var d,
              v,
              p,
              y,
              m,
              g,
              x,
              b,
              k,
              T,
              P = new c((t.x + e.x) / 2, (t.y + e.y) / 2, t.z),
              M = !0;
            for (var S in n) {
              for (var _ = n[S].length, O = 0, I = _ - 1; O < _; I = O++) {
                if (
                  ((p = i[n[S][O]]),
                  (y = i[n[S][I]]),
                  (m = void 0),
                  (b = void 0),
                  (g = (m = s((d = t), (v = e)))(p.x, p.y)),
                  (x = m(y.x, y.y)),
                  (k = (b = s(p, y))(d.x, d.y)),
                  (T = b(v.x, v.y)),
                  !(
                    o(d, p) < 0.15 ||
                    o(v, p) < 0.15 ||
                    o(d, y) < 0.15 ||
                    o(v, y) < 0.15
                  ) &&
                    ((Math.abs(g) < 0.01 && k * T <= 0) ||
                      (Math.abs(x) < 0.01 && k * T <= 0) ||
                      (g * x < 0 && k * T < 0)))
                ) {
                  M = !1;
                  break;
                }
              }
              if (!(M = M && l(P, n[S], i) === (0 == S))) return !1;
            }
            return !0;
          },
          polygonConnection: function (t) {
            var e = this.addIntersectionToVertexes(t),
              i = [],
              n = void 0;
            if ("multi-polygon" === e.geometry) {
              n = this.vertexesToPolygon(e);
              var s = !0,
                r = !1,
                o = void 0;
              try {
                for (
                  var a, h = e.vertexes[Symbol.iterator]();
                  !(s = (a = h.next()).done);
                  s = !0
                ) {
                  var l = a.value;
                  (i = i.concat(l)).pop(), this.addDirectNebor(l);
                }
              } catch (t) {
                (r = !0), (o = t);
              } finally {
                try {
                  !s && h.return && h.return();
                } finally {
                  if (r) throw o;
                }
              }
            } else
              "polygon" === e.geometry &&
                ((n = this.vertexesToPolygon(e)),
                (i = i.concat(e.vertexes)).pop(),
                this.addDirectNebor(e.vertexes));
            var c = !0,
              u = !1,
              f = void 0;
            try {
              for (
                var d, v = e.intersections[Symbol.iterator]();
                !(c = (d = v.next()).done);
                c = !0
              ) {
                var p = d.value;
                -1 === i.indexOf(p) && i.push(p);
              }
            } catch (t) {
              (u = !0), (f = t);
            } finally {
              try {
                !c && v.return && v.return();
              } finally {
                if (u) throw f;
              }
            }
            for (var y = 0; y < i.length; y++)
              for (var m = y + 1; m < i.length; m++)
                -1 === this.connections[i[y]].ne.indexOf(i[m]) &&
                  this.isNeighborPolygon(i[y], i[m], n) &&
                  (this.connections[i[y]].ne.push(i[m]),
                  this.connections[i[m]].ne.push(i[y]));
          },
          addDirectNebor: function (t) {
            for (var e = 0; e < t.length - 1; e++)
              this.connections[t[e]].ne.push(t[e + 1]),
                this.connections[t[e + 1]].ne.push(t[e]);
          },
          projectPoint2LineDistance: function (t, e, i) {
            var n =
              (t[0] - e[0]) * (i[0] - e[0]) + (t[1] - e[1]) * (i[1] - e[1]);
            if (n <= 0) return this.euclideanDist(t, e);
            var s = Math.pow(this.euclideanDist(e, i), 2);
            if (n >= s) return this.euclideanDist(t, i);
            var r = n / s,
              o = [e[0] + r * (i[0] - e[0]), e[1] + r * (i[1] - e[1])];
            return this.euclideanDist(t, o);
          },
          euclideanDist: function (t, e) {
            return Math.sqrt(
              Math.pow(t[0] - e[0], 2) + Math.pow(t[1] - e[1], 2),
            );
          },
          addIntersectionToVertexes: function (t) {
            var e = r(t);
            if ("polygon" === e.geometry) e.vertexes.push(e.vertexes[0]);
            else if ("multi-polygon" === e.geometry) {
              var i = !0,
                n = !1,
                s = void 0;
              try {
                for (
                  var o, a = e.vertexes[Symbol.iterator]();
                  !(i = (o = a.next()).done);
                  i = !0
                ) {
                  var h = o.value;
                  h.push(h[0]);
                }
              } catch (t) {
                (n = !0), (s = t);
              } finally {
                try {
                  !i && a.return && a.return();
                } finally {
                  if (n) throw s;
                }
              }
            }
            for (var l = 0; l < e.intersections.length; l++)
              if (
                "polygon" !== e.geometry ||
                -1 === e.vertexes.indexOf(e.intersections[l])
              ) {
                if (
                  "multi-polygon" === e.geometry &&
                  -1 !== e.vertexes[0].indexOf(e.intersections[l])
                ) {
                  for (var c = !1, u = 0; u < e.vertexes.length; u++)
                    if (-1 !== e.vertexes[0].indexOf(e.intersections[l])) {
                      c = !0;
                      break;
                    }
                  if (c) continue;
                }
                var f = 0;
                if ("multi-polygon" === e.geometry) {
                  for (var d = 0; d < e.vertexes.length; d++)
                    for (var v = 0; v < e.vertexes[d].length - 1; v++) {
                      var p = [
                          this.connections[e.intersections[l]].x,
                          this.connections[e.intersections[l]].y,
                        ],
                        y = [
                          [
                            this.connections[e.vertexes[d][v]].x,
                            this.connections[e.vertexes[d][v]].y,
                          ],
                          [
                            this.connections[e.vertexes[d][v + 1]].x,
                            this.connections[e.vertexes[d][v + 1]].y,
                          ],
                        ],
                        m = this.projectPoint2LineDistance(p, y[0], y[1]);
                      f
                        ? m < f.dis &&
                          m < 0.02 &&
                          (f = {
                            ipid: e.intersections[l],
                            index: v,
                            dis: m,
                            ring: d,
                          })
                        : (f = {
                            ipid: e.intersections[l],
                            index: v,
                            dis: m,
                            ring: d,
                          });
                    }
                  f
                    ? e.vertexes[f.ring].slice(f.index, 0, f.ipid)
                    : (console.log(e.intersections[l]), console.log("error"));
                } else if ("polygon" === e.geometry) {
                  for (var g = 0; g < e.vertexes.length - 1; g++) {
                    var x = [
                        this.connections[e.intersections[l]].x,
                        this.connections[e.intersections[l]].y,
                      ],
                      b = [
                        [
                          this.connections[e.vertexes[g]].x,
                          this.connections[e.vertexes[g]].y,
                        ],
                        [
                          this.connections[e.vertexes[g + 1]].x,
                          this.connections[e.vertexes[g + 1]].y,
                        ],
                      ],
                      k = this.projectPoint2LineDistance(x, b[0], b[1]);
                    f
                      ? k < f.dis &&
                        k < 0.02 &&
                        (f = { ipid: e.intersections[l], index: g, dis: k })
                      : (f = { ipid: e.intersections[l], index: g, dis: k });
                  }
                  f
                    ? e.vertexes.slice(f.index, 0, f.ipid)
                    : (console.log(e.intersections[l]), console.log("error"));
                }
              }
            return e;
          },
          vertexesToPolygon: function (t) {
            var e = [],
              i = void 0;
            if ("multi-polygon" === t.geometry) {
              var n = [],
                s = !0,
                r = !1,
                o = void 0;
              try {
                for (
                  var a, h = t.vertexes[Symbol.iterator]();
                  !(s = (a = h.next()).done);
                  s = !0
                ) {
                  var l = a.value;
                  n = [];
                  var c = !0,
                    u = !1,
                    f = void 0;
                  try {
                    for (
                      var d, v = l[Symbol.iterator]();
                      !(c = (d = v.next()).done);
                      c = !0
                    ) {
                      var p = d.value;
                      n.push(p);
                    }
                  } catch (t) {
                    (u = !0), (f = t);
                  } finally {
                    try {
                      !c && v.return && v.return();
                    } finally {
                      if (u) throw f;
                    }
                  }
                  e.push(n);
                }
              } catch (t) {
                (r = !0), (o = t);
              } finally {
                try {
                  !s && h.return && h.return();
                } finally {
                  if (r) throw o;
                }
              }
              i = e;
            } else if ("polygon" === t.geometry) {
              var y = !0,
                m = !1,
                g = void 0;
              try {
                for (
                  var x, b = t.vertexes[Symbol.iterator]();
                  !(y = (x = b.next()).done);
                  y = !0
                ) {
                  var k = x.value;
                  e.push(k);
                }
              } catch (t) {
                (m = !0), (g = t);
              } finally {
                try {
                  !y && b.return && b.return();
                } finally {
                  if (m) throw g;
                }
              }
              i = [e];
            }
            return i;
          },
          v2RoadToV1: function (t, e) {
            var i = {};
            (i.vertexes = t.vertexes),
              1 !== t.factor && t.factor && (i.factor = t.factor);
            var n = t.factor || 1;
            if (
              ("level2" === t.type
                ? (i.factor = 2 * n)
                : "level3" === t.type
                  ? (i.factor = 5 * n)
                  : "level4" === t.type && (i.factor = 10 * n),
              t.cost && "-10000" !== e && "line" === t.geometry)
            ) {
              var s = o(
                this.connections[t.vertexes[0]],
                this.connections[t.vertexes[1]],
              );
              i.factor || (i.factor = 1), (i.factor += Math.ceil(t.cost / s));
            }
            if ((this.modeClass && (i.mode = t.mode), "-10000" === e)) {
              if (
                "line" === t.geometry &&
                (!0 === t.enable || void 0 === t.enable) &&
                (this.checkModeClass(t, "car") &&
                  ("slope" === t.type &&
                    (!0 === t.oneway && !1 === t.reverse
                      ? (this.drivingConnection[t.vertexes[0]].ne.push(
                          t.vertexes[1],
                        ),
                        (this.drivingConnection[t.vertexes[0]].type = [1]),
                        t.cost &&
                          (this.drivingConnection[t.vertexes[0]].cost = t.cost))
                      : !0 === t.oneway && !0 === t.reverse
                        ? (this.drivingConnection[t.vertexes[1]].ne.push(
                            t.vertexes[0],
                          ),
                          (this.drivingConnection[t.vertexes[1]].type = [1]),
                          t.cost &&
                            (this.drivingConnection[t.vertexes[1]].cost =
                              t.cost))
                        : (this.drivingConnection[t.vertexes[0]].ne.push(
                            t.vertexes[1],
                          ),
                          this.drivingConnection[t.vertexes[1]].ne.push(
                            t.vertexes[0],
                          ),
                          (this.drivingConnection[t.vertexes[0]].type = [1]),
                          (this.drivingConnection[t.vertexes[1]].type = [1]),
                          t.cost &&
                            ((this.drivingConnection[t.vertexes[0]].cost =
                              t.cost),
                            (this.drivingConnection[t.vertexes[1]].cost =
                              t.cost)))),
                  "lift" === t.type &&
                    (!0 === t.oneway && !1 === t.reverse
                      ? (this.drivingConnection[t.vertexes[0]].ne.push(
                          t.vertexes[1],
                        ),
                        (this.drivingConnection[t.vertexes[0]].type = [3]),
                        t.cost &&
                          (this.drivingConnection[t.vertexes[0]].cost = t.cost))
                      : !0 === t.oneway && !0 === t.reverse
                        ? (this.drivingConnection[t.vertexes[1]].ne.push(
                            t.vertexes[0],
                          ),
                          (this.drivingConnection[t.vertexes[1]].type = [3]),
                          t.cost &&
                            (this.drivingConnection[t.vertexes[1]].cost =
                              t.cost))
                        : (this.drivingConnection[t.vertexes[0]].ne.push(
                            t.vertexes[1],
                          ),
                          this.drivingConnection[t.vertexes[1]].ne.push(
                            t.vertexes[0],
                          ),
                          (this.drivingConnection[t.vertexes[0]].type = [3]),
                          (this.drivingConnection[t.vertexes[1]].type = [3]),
                          t.cost &&
                            ((this.drivingConnection[t.vertexes[0]].cost =
                              t.cost),
                            (this.drivingConnection[t.vertexes[1]].cost =
                              t.cost))))),
                this.checkModeClass(t, "walk"))
              ) {
                var r = void 0;
                "slope" === t.type
                  ? (r = [1])
                  : "lift" === t.type
                    ? (r = [3])
                    : "stairs" === t.type
                      ? (r = [6])
                      : "escalator" === t.type
                        ? (r = [1024])
                        : "lift_stairs" === t.type && (r = [3, 6]),
                  !0 !== t.oneway || t.reverse
                    ? !0 === t.oneway && !0 === t.reverse
                      ? (this.connections[t.vertexes[1]].ne.push(t.vertexes[0]),
                        (this.connections[t.vertexes[1]].type = r),
                        t.cost &&
                          (this.connections[t.vertexes[1]].cost = t.cost))
                      : (this.connections[t.vertexes[0]].ne.push(t.vertexes[1]),
                        this.connections[t.vertexes[1]].ne.push(t.vertexes[0]),
                        (this.connections[t.vertexes[0]].type = r),
                        (this.connections[t.vertexes[1]].type = r),
                        t.cost &&
                          ((this.connections[t.vertexes[0]].cost = t.cost),
                          (this.connections[t.vertexes[1]].cost = t.cost)))
                    : (this.connections[t.vertexes[0]].ne.push(t.vertexes[1]),
                      (this.connections[t.vertexes[0]].type = r),
                      t.cost &&
                        (this.connections[t.vertexes[0]].cost = t.cost));
              }
            } else
              (!0 !== t.enable && void 0 !== t.enable) ||
                (t.type &&
                !["primary", "level2", "level3", "level4"].includes(t.type)
                  ? (this.checkModeClass(t, "walk") &&
                      (!0 !== t.oneway || t
                        ? !0 === t.oneway && !0 === t.reverse
                          ? (this.connections[t.vertexes[1]].special ||
                              (this.connections[t.vertexes[1]].special = {
                                ne: [],
                                type: [],
                              }),
                            this.connections[t.vertexes[1]].ne.push(
                              t.vertexes[0],
                            ),
                            this.turns.hasOwnProperty(t.vertexes[0]) &&
                              this.turns[t.vertexes[0]].fromNe.push(
                                t.vertexes[1],
                              ),
                            this.connections[t.vertexes[1]].special.ne.push(
                              t.vertexes[0],
                            ),
                            this.connections[t.vertexes[1]].special.type.push(
                              t.type,
                            ))
                          : (this.connections[t.vertexes[0]].special ||
                              (this.connections[t.vertexes[0]].special = {
                                ne: [],
                                type: [],
                              }),
                            this.connections[t.vertexes[1]].special ||
                              (this.connections[t.vertexes[1]].special = {
                                ne: [],
                                type: [],
                              }),
                            this.connections[t.vertexes[0]].ne.push(
                              t.vertexes[1],
                            ),
                            this.connections[t.vertexes[0]].special.ne.push(
                              t.vertexes[1],
                            ),
                            this.connections[t.vertexes[0]].special.type.push(
                              t.type,
                            ),
                            this.connections[t.vertexes[1]].ne.push(
                              t.vertexes[0],
                            ),
                            this.connections[t.vertexes[1]].special.ne.push(
                              t.vertexes[0],
                            ),
                            this.connections[t.vertexes[1]].special.type.push(
                              t.type,
                            ),
                            this.turns.hasOwnProperty(t.vertexes[1]) &&
                              this.turns[t.vertexes[1]].fromNe.push(
                                t.vertexes[0],
                              ),
                            this.turns.hasOwnProperty(t.vertexes[0]) &&
                              this.turns[t.vertexes[0]].fromNe.push(
                                t.vertexes[1],
                              ))
                        : (this.connections[t.vertexes[0]].special ||
                            (this.connections[t.vertexes[0]].special = {
                              ne: [],
                              type: [],
                            }),
                          this.connections[t.vertexes[0]].ne.push(
                            t.vertexes[1],
                          ),
                          this.turns.hasOwnProperty(t.vertexes[1]) &&
                            this.turns[t.vertexes[1]].fromNe.push(
                              t.vertexes[0],
                            ),
                          this.connections[t.vertexes[0]].special.ne.push(
                            t.vertexes[1],
                          ),
                          this.connections[t.vertexes[0]].special.type.push(
                            t.type,
                          ))),
                    this.checkModeClass(t, "car") &&
                      (!0 !== t.oneway || t
                        ? !0 === t.oneway && !0 === t.reverse
                          ? (this.drivingConnection[t.vertexes[1]].special ||
                              (this.drivingConnection[t.vertexes[1]].special = {
                                ne: [],
                                type: [],
                              }),
                            this.drivingConnection[t.vertexes[1]].ne.push(
                              t.vertexes[0],
                            ),
                            this.carTurns.hasOwnProperty(t.vertexes[0]) &&
                              this.carTurns[t.vertexes[0]].fromNe.push(
                                t.vertexes[1],
                              ),
                            this.drivingConnection[
                              t.vertexes[1]
                            ].special.ne.push(t.vertexes[0]),
                            this.drivingConnection[
                              t.vertexes[1]
                            ].special.type.push(t.type))
                          : (this.drivingConnection[t.vertexes[0]].special ||
                              (this.drivingConnection[t.vertexes[0]].special = {
                                ne: [],
                                type: [],
                              }),
                            this.drivingConnection[t.vertexes[1]].special ||
                              (this.drivingConnection[t.vertexes[1]].special = {
                                ne: [],
                                type: [],
                              }),
                            this.drivingConnection[t.vertexes[0]].ne.push(
                              t.vertexes[1],
                            ),
                            this.drivingConnection[
                              t.vertexes[0]
                            ].special.ne.push(t.vertexes[1]),
                            this.drivingConnection[
                              t.vertexes[0]
                            ].special.type.push(t.type),
                            this.drivingConnection[t.vertexes[1]].ne.push(
                              t.vertexes[0],
                            ),
                            this.drivingConnection[
                              t.vertexes[1]
                            ].special.ne.push(t.vertexes[0]),
                            this.drivingConnection[
                              t.vertexes[1]
                            ].special.type.push(t.type),
                            this.carTurns.hasOwnProperty(t.vertexes[1]) &&
                              this.carTurns[t.vertexes[1]].fromNe.push(
                                t.vertexes[0],
                              ),
                            this.carTurns.hasOwnProperty(t.vertexes[0]) &&
                              this.carTurns[t.vertexes[0]].fromNe.push(
                                t.vertexes[1],
                              ))
                        : (this.drivingConnection[t.vertexes[0]].special ||
                            (this.drivingConnection[t.vertexes[0]].special = {
                              ne: [],
                              type: [],
                            }),
                          this.drivingConnection[t.vertexes[0]].ne.push(
                            t.vertexes[1],
                          ),
                          this.carTurns.hasOwnProperty(t.vertexes[1]) &&
                            this.carTurns[t.vertexes[1]].fromNe.push(
                              t.vertexes[0],
                            ),
                          this.drivingConnection[t.vertexes[0]].special.ne.push(
                            t.vertexes[1],
                          ),
                          this.drivingConnection[
                            t.vertexes[0]
                          ].special.type.push(t.type))))
                  : ("line" === t.geometry &&
                      (this.checkModeClass(t, "car") &&
                        (this.drivingRoads[e] || (this.drivingRoads[e] = []),
                        t.oneway ||
                          (this.drivingRoads[e].push(i),
                          this.drivingConnection[t.vertexes[0]].ne.push(
                            t.vertexes[1],
                          ),
                          this.drivingConnection[t.vertexes[1]].ne.push(
                            t.vertexes[0],
                          ),
                          this.carTurns.hasOwnProperty(t.vertexes[1]) &&
                            this.carTurns[t.vertexes[1]].fromNe.push(
                              t.vertexes[0],
                            ),
                          this.carTurns.hasOwnProperty(t.vertexes[0]) &&
                            this.carTurns[t.vertexes[0]].fromNe.push(
                              t.vertexes[1],
                            )),
                        !0 !== t.oneway ||
                          t.reverse ||
                          ((i.one_way = !0),
                          this.drivingRoads[e].push(i),
                          this.drivingConnection[t.vertexes[0]].ne.push(
                            t.vertexes[1],
                          ),
                          this.carTurns.hasOwnProperty(t.vertexes[1]) &&
                            this.carTurns[t.vertexes[1]].fromNe.push(
                              t.vertexes[0],
                            )),
                        !0 === t.oneway &&
                          !0 === t.reverse &&
                          ((i.one_way = !0),
                          (i.vertexes = [t.vertexes[1], t.vertexes[0]]),
                          this.drivingRoads[e].push(i),
                          this.drivingConnection[t.vertexes[1]].ne.push(
                            t.vertexes[0],
                          ),
                          this.carTurns.hasOwnProperty(t.vertexes[0]) &&
                            this.carTurns[t.vertexes[0]].fromNe.push(
                              t.vertexes[1],
                            ))),
                      this.checkModeClass(t, "walk") &&
                        (t.oneway ||
                          (this.roads[e].push(i),
                          this.connections[t.vertexes[0]].ne.push(
                            t.vertexes[1],
                          ),
                          this.connections[t.vertexes[1]].ne.push(
                            t.vertexes[0],
                          ),
                          this.turns.hasOwnProperty(t.vertexes[1]) &&
                            this.turns[t.vertexes[1]].fromNe.push(
                              t.vertexes[0],
                            ),
                          this.turns.hasOwnProperty(t.vertexes[0]) &&
                            this.turns[t.vertexes[0]].fromNe.push(
                              t.vertexes[1],
                            )),
                        !0 !== t.oneway ||
                          t.reverse ||
                          ((i.one_way = !0),
                          this.roads[e].push(i),
                          this.connections[t.vertexes[0]].ne.push(
                            t.vertexes[1],
                          ),
                          this.turns.hasOwnProperty(t.vertexes[1]) &&
                            this.turns[t.vertexes[1]].fromNe.push(
                              t.vertexes[0],
                            )),
                        !0 === t.oneway &&
                          !0 === t.reverse &&
                          ((i.one_way = !0),
                          (i.vertexes = [t.vertexes[1], t.vertexes[0]]),
                          this.roads[e].push(i),
                          this.connections[t.vertexes[1]].ne.push(
                            t.vertexes[0],
                          ),
                          this.turns.hasOwnProperty(t.vertexes[0]) &&
                            this.turns[t.vertexes[0]].fromNe.push(
                              t.vertexes[1],
                            )))),
                    ("polygon" !== t.geometry &&
                      "multi-polygon" !== t.geometry) ||
                      ((i.intersections = t.intersections),
                      "multi-polygon" === t.geometry &&
                        1 === t.vertexes.length &&
                        ((t.vertexes = t.vertexes[0]),
                        (t.geometry = "polygon"),
                        (i.vertexes = t.vertexes)),
                      this.roads[e].push(i))));
          },
          getAllPoints: function (t) {
            if ("multi-polygon" === t.geometry) {
              var e = !0,
                i = !1,
                n = void 0;
              try {
                for (
                  var s, r = t.vertexes[Symbol.iterator]();
                  !(e = (s = r.next()).done);
                  e = !0
                ) {
                  var o = s.value,
                    a = !0,
                    h = !1,
                    l = void 0;
                  try {
                    for (
                      var c, u = o[Symbol.iterator]();
                      !(a = (c = u.next()).done);
                      a = !0
                    ) {
                      var f = c.value;
                      this.newConnectionSet.add(f);
                    }
                  } catch (t) {
                    (h = !0), (l = t);
                  } finally {
                    try {
                      !a && u.return && u.return();
                    } finally {
                      if (h) throw l;
                    }
                  }
                }
              } catch (t) {
                (i = !0), (n = t);
              } finally {
                try {
                  !e && r.return && r.return();
                } finally {
                  if (i) throw n;
                }
              }
            } else {
              if ("polygon" === t.geometry || this.checkModeClass(t, "walk")) {
                var d = !0,
                  v = !1,
                  p = void 0;
                try {
                  for (
                    var y, m = t.vertexes[Symbol.iterator]();
                    !(d = (y = m.next()).done);
                    d = !0
                  ) {
                    var g = y.value;
                    this.newConnectionSet.add(g);
                  }
                } catch (t) {
                  (v = !0), (p = t);
                } finally {
                  try {
                    !d && m.return && m.return();
                  } finally {
                    if (v) throw p;
                  }
                }
              }
              if ("line" === t.geometry && this.checkModeClass(t, "car")) {
                var x = !0,
                  b = !1,
                  k = void 0;
                try {
                  for (
                    var T, P = t.vertexes[Symbol.iterator]();
                    !(x = (T = P.next()).done);
                    x = !0
                  ) {
                    var M = T.value;
                    this.newCarConnectionSet.add(M);
                  }
                } catch (t) {
                  (b = !0), (k = t);
                } finally {
                  try {
                    !x && P.return && P.return();
                  } finally {
                    if (b) throw k;
                  }
                }
              }
            }
          },
          loadModeClass: function (t) {
            if (((this.modeClass = { car: [], walk: [] }), t.car)) {
              var e = !0,
                i = !1,
                n = void 0;
              try {
                for (
                  var s, r = t.car[Symbol.iterator]();
                  !(e = (s = r.next()).done);
                  e = !0
                ) {
                  var o = s.value;
                  this.modeClass.car.push(o.id);
                }
              } catch (t) {
                (i = !0), (n = t);
              } finally {
                try {
                  !e && r.return && r.return();
                } finally {
                  if (i) throw n;
                }
              }
            }
            if (t.walk) {
              var a = !0,
                h = !1,
                l = void 0;
              try {
                for (
                  var c, u = t.walk[Symbol.iterator]();
                  !(a = (c = u.next()).done);
                  a = !0
                ) {
                  var f = c.value;
                  this.modeClass.walk.push(f.id);
                }
              } catch (t) {
                (h = !0), (l = t);
              } finally {
                try {
                  !a && u.return && u.return();
                } finally {
                  if (h) throw l;
                }
              }
            }
          },
          checkModeClass: function (t, e) {
            if (!this.modeClass) return t.mode.includes(e);
            if (t.mode.includes(e)) return !0;
            var i = !0,
              n = !1,
              s = void 0;
            try {
              for (
                var r, o = t.mode[Symbol.iterator]();
                !(i = (r = o.next()).done);
                i = !0
              ) {
                var a = r.value;
                if (-1 !== this.modeClass[e].indexOf(a)) return !0;
              }
            } catch (t) {
              (n = !0), (s = t);
            } finally {
              try {
                !i && o.return && o.return();
              } finally {
                if (n) throw s;
              }
            }
            return !1;
          },
        }),
        (e.V2toV1Converter = u);
    },
    ,
    function (t, e, i) {
      Object.defineProperty(e, "__esModule", { value: !0 }),
        (e.seeklaneEngine = void 0);
      var n = i(7),
        s = i(0),
        r = i(6),
        o = i(57),
        a = i(58),
        h = i(59),
        l = {
          cm: {
            fm: a.FloorMapper,
            hu: r.HMMUtils,
            hh: r.HmmHelper,
            hp: r.Point,
            hdl: o.HmmDataLoader,
            v2v1: h.V2toV1Converter,
          },
          li: n.LocationInterface,
          lc: s.CONSTANTS,
        };
      e.seeklaneEngine = l;
    },
  ]);
});
